)]}'
{
  "commit": "496e05a32afe498db1f1cc76cde5defce9cbd185",
  "tree": "42072857ed573acea476fc4fd90ac8563ed1dd4c",
  "parents": [
    "2636da31af44fab38c22cee0fe771761173ea64b"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Wed Sep 09 15:09:03 2026 +0200"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Wed Sep 09 15:09:03 2026 +0200"
  },
  "message": "[gdb/stabs] Fix out-of-bounds write in read_member_functions\n\nCVE-2026-13732 reports:\n...\ngdb: out-of-bounds write in stabs parser read_member_functions() via crafted elf\n\nA flaw was found in GDB\u0027s STABS debug format parser. The read_member_functions()\nfunction in gdb/stabsread.c contains a linked list removal bug in the code that\nseparates destructor and non-destructor member functions of C++ classes. The bug\ncauses the destructor entries to remain in the main function list while the list\nlength counter is decremented, resulting in an out-of-bounds write when the\nfunction list is copied to its final allocated array. An attacker can craft an\nELF binary with malicious .stab and .stabstr sections that triggers this\nout-of-bounds write when a user opens the file in GDB and performs any\nsymbol-inspection operation such as setting a breakpoint. The inferior process\ndoes not need to be executed. Under controlled conditions, this was demonstrated\nto achieve execution of arbitrary commands within the GDB process.\n...\n\nAFAIU from gdb/SECURITY.txt:\n...\n  There are known bugs in GDB related to loading malformed executables\n  and parsing the debug information, a consequence of these bugs is\n  that a malicious program could trigger undefined behavior in GDB,\n  which could be used to trigger arbitrary code execution.\n\n  Given these risks, the advice of the GDB project is that, when using\n  GDB with an untrusted binary, always do so in a secure, sandboxed\n  environment.\n\n  As there are already known bugs in GDB relating to undefined\n  behavior triggered from malformed programs, further bugs in this\n  area should still be reported, but are unlikely to be given high\n  priority.  Bugs in GDB that are triggered by well-formed programs\n  should also be reported, and are likely to be treated as higher\n  priority as these are more likely to impact normal use of GDB.\n...\nthis is not a high priority.  Still, it\u0027s worthwhile fixing this.\n\nThe problem is single-linked list update logic.\n\nI wrote a stand alone reproducer containing fix and unit test:\n...\n #include \u003cstdio.h\u003e\n #include \u003cassert.h\u003e\n\n #ifndef FIX\n #define FIX 0\n #endif\n\n #ifndef VERBOSE\n #define VERBOSE 0\n #endif\n\nstruct s\n{\n  int i;\n  struct s *next;\n};\n\nstatic int test_mode \u003d 0;\nstatic int max_test_mode \u003d 11;\n\nstatic int\ntest (int i)\n{\n  switch (test_mode)\n    {\n    case 0:\n      return 0;\n    case 1:\n      return 1;\n    case 2:\n      return i % 2 \u003d\u003d 0;\n    case 3:\n      return i % 2 \u003d\u003d 1;\n    case 4:\n      return i \u003d\u003d 1;\n    case 5:\n      return i !\u003d 1;\n    case 6:\n      return i \u003d\u003d 6;\n    case 7:\n      return i !\u003d 6;\n    case 8:\n      return i \u003e\u003d 5;\n    case 9:\n      return !(i \u003e\u003d 5);\n    case 10:\n      return (i \u003d\u003d 3 || i \u003d\u003d 4);\n    case 11:\n      return !(i \u003d\u003d 3 || i \u003d\u003d 4);\n    default:\n      assert (0);\n    }\n}\n\nstatic struct s *\nfilter (struct s *sublist)\n{\n  struct s *tmp_sublist;\n  struct s *last_sublist;\n\n  tmp_sublist \u003d sublist;\n  last_sublist \u003d NULL;\n  while (tmp_sublist !\u003d NULL)\n    {\n      if (test (tmp_sublist-\u003ei))\n\t{\n\t  if (FIX)\n\t    last_sublist \u003d tmp_sublist;\n\t  tmp_sublist \u003d tmp_sublist-\u003enext;\n\t  continue;\n\t}\n\n      if (last_sublist)\n\tlast_sublist-\u003enext \u003d tmp_sublist-\u003enext;\n      else\n\tsublist \u003d tmp_sublist-\u003enext;\n      if (!FIX)\n\tlast_sublist \u003d tmp_sublist;\n      tmp_sublist \u003d tmp_sublist-\u003enext;\n    }\n\n  return sublist;\n}\n\nstruct s s1, s2, s3, s4, s5, s6;\n\nstatic int\ninit (int i)\n{\n  s1.i \u003d 1;\n  s2.i \u003d 2;\n  s3.i \u003d 3;\n  s4.i \u003d 4;\n  s5.i \u003d 5;\n  s6.i \u003d 6;\n\n  s1.next \u003d NULL;\n  s2.next \u003d \u0026s1;\n  s3.next \u003d \u0026s2;\n  s4.next \u003d \u0026s3;\n  s5.next \u003d \u0026s4;\n  s6.next \u003d \u0026s5;\n\n  switch (i)\n    {\n    case 0:\n      return 6;\n    case 1:\n      s5.next \u003d NULL;\n      return 2;\n    case 2:\n      s6.next \u003d NULL;\n      return 1;\n    default:\n      assert (false);\n    }\n}\n\nint\nmain ()\n{\n  assert (filter (NULL) \u003d\u003d NULL);\n\n  for (int i \u003d 0; i \u003c 3; ++i)\n    for (test_mode \u003d 0; test_mode \u003c\u003d max_test_mode; ++test_mode)\n      {\n\tint len \u003d init (i);\n\n\tstruct s *res \u003d filter (\u0026s6);\n\n\tif (VERBOSE)\n\t  {\n\t    printf (\"EXPECTED: \");\n\t    for (int i \u003d 6; i \u003e 6 - len; --i)\n\t      if (test (i))\n\t\tprintf (\" %d\", i);\n\t    printf (\"\\n\");\n\n\t    printf (\"ACTUAL  : \");\n\t    for (struct s *elem \u003d res; elem !\u003d NULL; elem \u003d elem-\u003enext)\n\t      printf (\" %d\", elem-\u003ei);\n\t    printf (\"\\n\");\n\t  }\n\n\tfor (struct s *elem \u003d res; elem !\u003d NULL; elem \u003d elem-\u003enext)\n\t  assert (test (elem-\u003ei));\n\n\tstruct s *elem \u003d res;\n\tfor (int i \u003d 6; i \u003e 6 - len; --i)\n\t  if (test (i))\n\t    {\n\t      assert (i \u003d\u003d elem-\u003ei);\n\t      elem \u003d elem-\u003enext;\n\t    }\n\tassert (elem \u003d\u003d NULL);\n      }\n\n  return 0;\n}\n...\n\nThis patch applies the same fix in read_member_functions.\n\nRelevant links:\n- http://web.nvd.nist.gov/view/vuln/detail?vulnId\u003dCVE-2026-13732\n- https://www.cve.org/CVERecord?id\u003dCVE-2026-13732\n- https://access.redhat.com/security/cve/CVE-2026-13732\n- https://bugzilla.redhat.com/show_bug.cgi?id\u003d2494416\n\nApproved-By: Simon Marchi \u003csimon.marchi@efficios.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2d1411e9146c489ce852a4c16248f776abb11f42",
      "old_mode": 33188,
      "old_path": "gdb/stabsread.c",
      "new_id": "6cc3c5c7e0254f56c40f586bc61dcf652b79f6de",
      "new_mode": 33188,
      "new_path": "gdb/stabsread.c"
    }
  ]
}
