aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-subr.c
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2021-09-27 20:31:21 +0100
committerNick Alcock <nick.alcock@oracle.com>2021-09-27 20:31:26 +0100
commit6ab5b6d0f3adc36303d2cc5308a92cf95e2801f9 (patch)
tree93320a807a43abf51f1ea4fb91f1a15a7908ae95 /libctf/ctf-subr.c
parente695879142a8e8b9f7e220a7919f38ad3ee614e6 (diff)
downloadgdb-6ab5b6d0f3adc36303d2cc5308a92cf95e2801f9.zip
gdb-6ab5b6d0f3adc36303d2cc5308a92cf95e2801f9.tar.gz
gdb-6ab5b6d0f3adc36303d2cc5308a92cf95e2801f9.tar.bz2
libctf, lookup: fix bounds of pptrtab lookup
An off-by-one bug in the check for pptrtab lookup meant that we could access the pptrtab past its bounds (*well* past its bounds), particularly if we called ctf_lookup_by_name in a child dict with "*foo" where "foo" is a type that exists in the parent but not the child and no previous lookups by name have been carried out. (Note that "*foo" is not even a valid thing to call ctf_lookup_by_name with: foo * is. Nonetheless, users sometimes do call ctf_lookup_by_name with invalid content, and it should return ECTF_NOTYPE, not crash.) ctf_pptrtab_len, as its name suggests (and as other tests of it in ctf-lookup.c confirm), is one higher than the maximum valid permissible index, so the comparison is wrong. (Test added, which should fail pretty reliably in the presence of this bug on any machine with 4KiB pages.) libctf/ChangeLog 2021-09-27 Nick Alcock <nick.alcock@oracle.com> * ctf-lookup.c (ctf_lookup_by_name_internal): Fix pptrtab bounds. * testsuite/libctf-writable/pptrtab-writable-page-deep-lookup.*: New test.
Diffstat (limited to 'libctf/ctf-subr.c')
0 files changed, 0 insertions, 0 deletions