Skip to content
  1. Nov 05, 2024
  2. Nov 01, 2024
  3. Jul 28, 2024
  4. Jul 23, 2024
  5. Jul 20, 2024
  6. Jul 13, 2024
  7. Jul 06, 2024
  8. Jun 24, 2024
  9. Jun 18, 2024
  10. Jun 15, 2024
  11. Jun 07, 2024
  12. Jun 02, 2024
  13. May 24, 2024
  14. May 07, 2024
    • José Expósito's avatar
      Fix buffer overrun in parse_omit_name · 97fb5bda
      José Expósito authored
      
      
      When `num_fields == 12`, if the last character of the pattern is '-',
      the `buf` array is overrun.
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: OVERRUN (CWE-119):
          libX11-1.8.7/modules/om/generic/omGeneric.c:691: cond_at_most:
            Checking "length > 255" implies that "length" may be up to 255 on
            the false branch.
          libX11-1.8.7/modules/om/generic/omGeneric.c:695: alias:
            Assigning: "last" = "buf   length - 1". "last" may now point to as
            high as byte 254 of "buf" (which consists of 256 bytes).
          libX11-1.8.7/modules/om/generic/omGeneric.c:718: ptr_incr:
            Incrementing "last". "last" may now point to as high as byte 255
            of "buf" (which consists of 256 bytes).
          libX11-1.8.7/modules/om/generic/omGeneric.c:720: ptr_incr:
            Incrementing "last". "last" may now point to as high as byte 256
            of "buf" (which consists of 256 bytes).
          libX11-1.8.7/modules/om/generic/omGeneric.c:720: overrun-local:
            Overrunning array of 256 bytes at byte offset 256 by
            dereferencing pointer "  last".
          #  718|               *  last = '*';
          #  719|
          #  720|->         *  last = '-';
          #  721|           break;
          #  722|       case 13:
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      97fb5bda
    • José Expósito's avatar
      Fix memory leak in _XimProtoSetIMValues · f67a87da
      José Expósito authored
      
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: RESOURCE_LEAK (CWE-772):
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1316: alloc_fn:
            Storage is returned from allocation function "calloc".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1316: var_assign:
            Assigning: "tmp" = storage returned from
            "calloc((size_t)((buf_size   data_len == 0) ? 1 : (buf_size   data_len)), 1UL)".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1319: noescape:
            Resource "tmp" is not freed or pointed-to in "memcpy".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1320: var_assign:
            Assigning: "buf" = "tmp".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1302: var_assign:
            Assigning: "data" = "buf".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1303: noescape:
            Resource "data" is not freed or pointed-to in
            "_XimEncodeIMATTRIBUTE".
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1333: leaked_storage:
            Variable "data" going out of scope leaks the storage it points to.
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1333: leaked_storage:
            Variable "buf" going out of scope leaks the storage it points to.
          libX11-1.8.7/modules/im/ximcp/imDefIm.c:1333: leaked_storage:
            Variable "tmp" going out of scope leaks the storage it points to.
          # 1331|
          # 1332|       if (!total)
          # 1333|->         return (char *)NULL;
          # 1334|
          # 1335|       buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      f67a87da
    • José Expósito's avatar
      XKBMAlloc: Check that needed is >= 0 in XkbResizeKeyActions · af1312d2
      José Expósito authored
      
      
      Passing a negative value in `needed` to the `XkbResizeKeyActions()`
      function can create a `newActs` array of an unespected size.
      Check the value and return if it is invalid.
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: OVERRUN (CWE-119):
          libX11-1.8.7/src/xkb/XKBMAlloc.c:811: cond_const:
            Checking "xkb->server->size_acts == 0" implies that
            "xkb->server->size_acts" is 0 on the true branch.
          libX11-1.8.7/src/xkb/XKBMAlloc.c:811: buffer_alloc:
            "calloc" allocates 8 bytes dictated by parameters
            "(size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts)"
            and "8UL".
          libX11-1.8.7/src/xkb/XKBMAlloc.c:811: var_assign:
            Assigning: "newActs" = "calloc((size_t)((xkb->server->size_acts == 0) ? 1 : xkb->server->size_acts), 8UL)".
          libX11-1.8.7/src/xkb/XKBMAlloc.c:815: assignment:
            Assigning: "nActs" = "1".
          libX11-1.8.7/src/xkb/XKBMAlloc.c:829: cond_at_least:
            Checking "nCopy > 0" implies that "nCopy" is at least 1 on the
            true branch.
          libX11-1.8.7/src/xkb/XKBMAlloc.c:830: overrun-buffer-arg:
            Overrunning buffer pointed to by "&newActs[nActs]" of 8 bytes by
            passing it to a function which accesses it at byte offset 15
            using argument "nCopy * 8UL" (which evaluates to 8).
          #  828|
          #  829|           if (nCopy > 0)
          #  830|->             memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i),
          #  831|                      nCopy * sizeof(XkbAction));
          #  832|           if (nCopy < nKeyActs)
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      af1312d2
    • José Expósito's avatar
      Fix use of uninitialized variable in _XimEncodeICATTRIBUTE · 836a8f2c
      José Expósito authored
      
      
      In the `res->resource_size == XimType_NEST` code path, if
      `res->xrm_name != pre_quark` and `res->xrm_name != sts_quark`, `len` can
      be used uninitialized.
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: UNINIT (CWE-457):
          libX11-1.8.7/modules/im/ximcp/imRmAttr.c:1106: var_decl:
            Declaring variable "len" without initializer.
          libX11-1.8.7/modules/im/ximcp/imRmAttr.c:1179: uninit_use:
            Using uninitialized value "len".
          # 1177|           }
          # 1178|
          # 1179|->         if (len == 0) {
          # 1180|               continue;
          # 1181|           } else if (len < 0) {
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      836a8f2c
    • José Expósito's avatar
      Fix use of uninitialized variable in _XimExtension · eaad761e
      José Expósito authored
      
      
      `_XimRead()` is being called with `reply` as target buffer instead of
      using `preply`, accessing uninitialized memory a few lines later.
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: UNINIT (CWE-457):
          libX11-1.8.7/modules/im/ximcp/imExten.c:468: alloc_fn:
            Calling "malloc" which returns uninitialized memory.
          libX11-1.8.7/modules/im/ximcp/imExten.c:468: assign:
            Assigning: "preply" = "malloc((size_t)((buf_size == 0) ? 1 : buf_size))",
            which points to uninitialized data.
          libX11-1.8.7/modules/im/ximcp/imExten.c:479: uninit_use:
            Using uninitialized value "*((CARD8 *)preply)".
          #  477|           return False;
          #  478|       buf_s = (CARD16 *)((char *)preply   XIM_HEADER_SIZE);
          #  479|->     if (*((CARD8 *)preply) == XIM_ERROR) {
          #  480|           _XimProcError(im, 0, (XPointer)&buf_s[3]);
          #  481|               if(reply != preply)
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      eaad761e
    • José Expósito's avatar
      Fix use of uninitialized variable in _XimTriggerNotify · 4f554119
      José Expósito authored
      
      
      `_XimRead()` is being called with `reply` as target buffer instead of
      using `preply`, accessing uninitialized memory a few lines later.
      
      This error has been found by a static analysis tool. This is the report:
      
          Error: UNINIT (CWE-457):
          libX11-1.8.7/modules/im/ximcp/imDefLkup.c:561: alloc_fn:
            Calling "malloc" which returns uninitialized memory.
          libX11-1.8.7/modules/im/ximcp/imDefLkup.c:561: assign:
            Assigning: "preply" = "malloc((size_t)((len == 0) ? 1 : len))",
            which points to uninitialized data.
          libX11-1.8.7/modules/im/ximcp/imDefLkup.c:573: uninit_use:
            Using uninitialized value "*((CARD8 *)preply)".
          #  571|       }
          #  572|       buf_s = (CARD16 *)((char *)preply   XIM_HEADER_SIZE);
          #  573|->     if (*((CARD8 *)preply) == XIM_ERROR) {
          #  574|           _XimProcError(im, 0, (XPointer)&buf_s[3]);
          #  575|           if(reply != preply)
      
      Signed-off-by: default avatarJosé Expósito <[email protected]>
      Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/250>
      4f554119
  15. Apr 25, 2024
  16. Apr 12, 2024
  17. Apr 05, 2024
  18. Mar 25, 2024
  19. Mar 24, 2024
  20. Feb 22, 2024