Update XPACK.cc to fix use-of-uninitialized-pointer-field case#11287
Conversation
|
I'm not too sure if we should do this, the memset. Use of uninitialized field implies reading an entry that does not exist. I think we should check index numbers instead so such access does not happen. Touching the entire buffer would suppress the report, but it can hide real issues. |
|
Let me give it more thoughts |
|
@maskit If we start from the beginning and insert an oversized entry, _make_space() will always look at the tail entry. So memset to 0 will make we fail gracefully. That's the problem the fuzz test is having. If we already have entries and now add an oversized entry, we need _make_space() to at least clear out all entries first before giving up. So we can't have a precondition check for an oversized entry. That is implied in the unit test - https://github.com/apache/trafficserver/blob/master/src/proxy/hdrs/unit_tests/test_XPACK.cc#L318 |
|
Shouldn't we call |
I agree. I just made a change for that. |
|
[approve ci fedora] |
|
[approve ci autest] |
|
@maskit it is ready for review again. Thanks |
|
Cherry-picked to v10.0.x |
* Update XPACK.cc * Update XPACK.cc * Update XPACK.cc * Update XPACK.cc * Update XPACK.cc * Update XPACK.cc * Update XPACK.cc (cherry picked from commit 9ebe5a2)
Fuzzing reveals a use-of-uninitialized-pointer-field case
https://oss-fuzz.com/testcase-detail/6285050312196096
I think this should fix the problem