[UB] Access out-of-bounds data when parsing invalid metadata items
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Inspect bintool/metadata.h around the linked lines, starting with how metadata item lengths are validated before the parser accesses data[i+1]. Exercise the parser with an invalid metadata item and confirm that it no longer performs an out-of-bounds access; the issue does not identify a test file.
Written by the indexing model from the issue text.
Description
This code effectively accesses the data at i and at i+1:
However, the code does not ensure that data[1] will be valid:
From https://en.cppreference.com/w/cpp/container/vector/operator_at:
No bounds checking is performed.
Therefore, no guarantee that this will throw an exception (which might be expected), and as a result, clearly getting into undefined behavior.....
- Dominant language
- C++
- Stars
- 999
- Forks
- 189
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/picotool
-
picotool load file.bin -o 0x11000000 always fails with second flash chip present and configured Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
raspberrypi/picotool#360 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
raspberrypi/picotool#347 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
raspberrypi/picotool#348 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
raspberrypi/picotool#344 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
raspberrypi/picotool#330 · 1 comment ·
All issues in raspberrypi/picotool
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·