inflate: annotate sliding window with sized_by_or_null - #1313
LaptopsPlural wants to merge 1 commit into
Conversation
|
I'm not sure why to add his as a header, but if this is really important for safety and it works, why is it an option? And why can this be enabled when clang is not used? And why did you change cmake wen your estplan is just configure? Not to mention why this is a benefit/problem. |
|
Thanks for the questions — happy to clarify. Why a header? Why optional if it matters for safety? Why can this be “enabled” when Clang is not used? Why change CMake when the test plan is just configure? What benefit / problem does this address? Happy to revise along whatever direction you and the maintainers prefer — especially dropping CMake and/or gating the option more strictly. |
Tie inflate_state.window to its capacity (wsize) with a native __attribute__((__sized_by_or_null__(wsize))) (or counted_by_or_null fallback) guarded by __has_attribute so unsupported compilers see an ordinary pointer. Keep capacity-before-pointer updates in inflate.c so the relationship stays consistent across allocate, reset, and free. Default builds are unchanged: no new headers, configure options, or CMake toggles.
3144388 to
e753135
Compare
|
@Vollstrecker Thanks again — revised along the lines you were pointing at. Dropped the optional Now The remaining |
Summary
Annotate private
inflate_state.windowwith a native__attribute__((__sized_by_or_null__(wsize)))(or__counted_by_or_null__fallback) behind__has_attribute, and keep capacity-before-pointer updates ininflate.cso the window↔wsize relationship stays consistent for static checking.Default builds are unchanged: unsupported compilers see an ordinary pointer; no new headers, configure options, or CMake toggles.
Test plan
./configure && make && make check