diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2021-09-27 20:31:21 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2021-09-27 20:31:26 +0100 |
commit | 6ab5b6d0f3adc36303d2cc5308a92cf95e2801f9 (patch) | |
tree | 93320a807a43abf51f1ea4fb91f1a15a7908ae95 /libctf/ChangeLog | |
parent | e695879142a8e8b9f7e220a7919f38ad3ee614e6 (diff) | |
download | gdb-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/ChangeLog')
-rw-r--r-- | libctf/ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index e66cf2a..5907e2f 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,11 @@ 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. + +2021-09-27 Nick Alcock <nick.alcock@oracle.com> + * testsuite/libctf-lookup/enum-symbol.c: Remove unused label. * testsuite/libctf-lookup/conflicting-type-syms.c: Remove unused variables. |