)]}'
{
  "commit": "8fdd2b2bcd8117cafcc6ef976e45f0d9f95fb528",
  "tree": "c9b099c4262698bb1ca583ff1494090cae00c561",
  "parents": [
    "bb07e97d25b33d8cdcce5238bc0e292308bf570d"
  ],
  "author": {
    "name": "Hannes Domani",
    "email": "ssbssa@yahoo.de",
    "time": "Tue Aug 06 19:34:18 2024 +0200"
  },
  "committer": {
    "name": "Hannes Domani",
    "email": "ssbssa@yahoo.de",
    "time": "Tue Aug 06 19:36:25 2024 +0200"
  },
  "message": "Mark unavailable bytes of limited-length arrays when allocating contents\n\nUsing \u0027output\u0027 to print arrays larger than max-value-size, with only\nrepeating elements, can cause gdb to crash:\n```\n$ cat a.c:\nchar a[1000000];\n\nint main()\n{\n  return a[0];\n}\n$ gdb -q a\n(gdb) print a\n$1 \u003d {0 \u0027\\000\u0027 \u003crepeats 65536 times\u003e, \u003cunavailable\u003e \u003crepeats 934464 times\u003e}\n(gdb) output a\n\nThis application has requested the Runtime to terminate it in an unusual way.\nPlease contact the application\u0027s support team for more information.\n```\n\nUsing \u0027print\u0027 works, because value::record_latest sets the unavailable\nbytes of the value when it\u0027s added to the value history.\nBut \u0027outout\u0027 doesn\u0027t do that, so the printing tries to access more bytes\nthan are available.\n\nThe original problem in PR32015 was about using \u0027print\u0027 of a dynamic\narray in a D program.\nHere the crash happens because for \u0027print\u0027 the value was a struct with\nlength/ptr fields, which is converted in d-valprint.c into an array.\nSo value::record_latest didn\u0027t have a chance to mark the unavailable\nbytes in this case.\n\nTo make sure the unavailable bytes always match the contents, this fixes\nit by marking the unavailable bytes immediately after the contents are\nallocated.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d32015\nReviewed-By: Alexandra Petlanova Hajkova \u003cahajkova@redhat.com\u003e\nApproved-By: Andrew Burgess \u003caburgess@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "627c34d2dbe8f423f2a04ac702ed7685923e602e",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/limited-length.c",
      "new_id": "c8ece16167eb76ca01b913353806967365ed26c8",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/limited-length.c"
    },
    {
      "type": "modify",
      "old_id": "a24adcb458a48b8fd4394f3cf74651d096853f2b",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/limited-length.exp",
      "new_id": "2d160e128ae1e1ccf6d0582fcbf849e66b8705cc",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/limited-length.exp"
    },
    {
      "type": "modify",
      "old_id": "09fb19b9bf8a1a3ab910987690c00eb0d7236a32",
      "old_mode": 33188,
      "old_path": "gdb/value.c",
      "new_id": "aaa9ed20ae1c211a5a0f7d9f0c9fa2bd629b6356",
      "new_mode": 33188,
      "new_path": "gdb/value.c"
    }
  ]
}
