Potential fix for code scanning alert no. 1901: Unsigned difference expression compared to zero#25
Open
HaplessIdiot wants to merge 438 commits into
Open
Potential fix for code scanning alert no. 1901: Unsigned difference expression compared to zero#25HaplessIdiot wants to merge 438 commits into
HaplessIdiot wants to merge 438 commits into
Conversation
…aki. I've finally contacted with Yamasaki-san and he kindly answered "no objection to change them to 2 clause license" in private mail. Diffs to be committed have also been confirmed by him. We appreciate all his contribution to early NetBSD/x68k.
https://mail-index.netbsd.org/source-changes/2020/07/18/msg119473.html > Use AllocDevicePair() to initialize input devices in InitInput(). Untested, but I'll re-visit on migrating to HAVE_XORG_SERVER_VER=120.
Use the NotifyFd API instead as per upstream commits: https://cgit.freedesktop.org/xorg/xserver/commit/?id=55c2e1a3aa587c58a74066724e11e30b3df267b8 https://cgit.freedesktop.org/xorg/xserver/commit/?id=be5a513fee6cbf29ef7570e57eb0436d70fbd88c https://cgit.freedesktop.org/xorg/xserver/commit/?id=60a91031d13e4d29c383087120e318f6b528b6e5 https://cgit.freedesktop.org/xorg/xserver/commit/?id=7def2fea30060d47780dc1eedc91fada5ae1934f
As per upstream commits for Xnest: https://cgit.freedesktop.org/xorg/xserver/commit/?id=67c303fff303f94b62f03a76de97116c6ebcfda9 Note GLXEXT is defined as 1 in xorg-server/include/xorg-server.h (i.e. /usr/X11R7/include/xorg/xorg-server.h) so no proper way to disable it on building MD servers per ${MACHINE} basis.
https://mail-index.netbsd.org/source-changes/2020/07/18/msg119488.html > Fix 1bpp Xservers on "whitePixel=0, blackPixel=1" VRAMs. > > - Don't override pScreen->blackPixel and pScreen->whitePixel > (set in MD server Init functions per -filpPixels option) > on 1bpp servers in merged fbSetupScreen() (merged one > from cfbSetupScrenn and mfbSetupScreen() in old xsrc/xfree) > - Pull mfbCreateColormap() function from old xsrc/xfree tree > and use it on 1bpp servers Confirmed on luna68k 1bpp Xorg 1.20 server using xf86-video-wsfb with "-flipPixels" option.
This is based on 1.10 version imported into xorg-server.old and all upstream API changes between xorg-server 1.10 and 1.20 are applied almost mechanically. https://github.com/tsutsui/xorg-server-Xsun/commits/xorg-server-1.20 Xsun and XsunMono servers are also confirmed working with bwtwo on 3/60 and tme, and cgtwo on tme. XKB stuff is still to be resolved.
Fixes build error on sparc64. No binary change on sun3.
This should be updated before 1.20 import: https://cgit.freedesktop.org/xorg/xserver/commit/?id=87d4f90bfcb509471ac9e7886e14a92b33223fd7
Botched in mechanical 1.20 updates.
Now CapsLock and NumLock LEDs work correctly. XXX: No ScrollLock LED
Now ScrollLock LED works properly.
…ball. From aac28e1 Mon Sep 17 00:00:00 2001 From: Matthieu Herrb <matthieu@herrb.eu> Date: Sat, 25 Jul 2020 19:33:50 +0200 Subject: [PATCH] fix for ZDI-11426 Avoid leaking un-initalized memory to clients by zeroing the whole pixmap on initial allocation. This vulnerability was discovered by: Jan-Niklas Sohn working with Trend Micro Zero Day Initiative Signed-off-by: Matthieu Herrb <matthieu@herrb.eu> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
…tings. Now all modifier keys (CTRL, SHIFT, and NumLock) work as expected. It seems XkbApplyMappingChange() doesn't update some XKB modifier settings even if new modmap data is specified.
Potential fix for code scanning alert no. 62: Non-constant format string
… pair is supported"
…pr-1780 Revert "glamor/glamor_egl.c: Check if at least one (format, modifier) pair is supported"
… pair is supported"
…pr-1780 Revert "glamor/glamor_egl.c: Check if at least one (format, modifier) pair is supported"
Make IgnoreABI configurable through config files
Unify intel video driver and evdev input inside source tree
…xpression compared to zero Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Potential fix for https://github.com/supersonic-xserver/ssX/security/code-scanning/1901
In general, to fix this kind of issue, make sure that any relational comparison involving the result of an unsigned subtraction is done in a signed type, or re-express the logic without subtracting unsigned values. In this specific case, we want to check whether there is a positive microsecond remainder after converting a time delta
d(in microseconds) to milliseconds, and use that to decide whether to add a bit of extra delay. The current code does this using(CARD32) dand subtractingd_ms * 1000, which causes unsigned underflow and makes the comparison unreliable.The best fix is to keep all of this “remainder” computation in a signed 64-bit type, consistent with
d, and only cast toCARD32at the final assignment tod_ms. Concretely:d_msasd / 1000in anint64_ttemporary (e.g.,int64_t d_ms64), then clamp it to theCARD32range when assigning tod_msif needed.d - (int64_t)d_ms * 1000in signed arithmetic, and compare that to zero.d % 1000on the signedint64_t, which is even clearer.Because we must avoid changing global behavior, we should preserve the high-level logic: if there is a positive microsecond remainder, add 2 ms; otherwise, add 1 ms. We’ll therefore:
int64_t d_ms64variable.d_ms = (CARD32) d / 1000;with computingd_ms64 = d / 1000;and thend_ms = (CARD32)d_ms64;(assuming the existing code implicitly assumesdfits; if needed, we could clamp but that would be a behavioral change, so we’ll mirror the existing assumption).(CARD32) d - d_ms * 1000 > 0with(d - (int64_t)d_ms * 1000) > 0, so the subtraction is done in signed 64-bit arithmetic.All changes are confined to the shown function in
hw/xfree86/drivers/amdgpu/amdgpu_dri2.c; no new headers or external libraries are needed.Suggested fixes powered by Copilot Autofix. Review carefully before merging.