SIGN IN SIGN UP

fix: BJData size calculation overflow (#4765)

Adds pre-multiplication overflow detection to catch cases where dimension
products would exceed size_t max. The previous check only detected when
overflow resulted in exactly 0 or SIZE_MAX, missing other cases.

Retains the original post-multiplication check for backward compatibility.
Adds tests verifying overflow detection with dimensions (2^32+1)×(2^32),
which previously overflowed silently to 2^32.

This prevents custom SAX handlers from receiving incorrect array sizes
that could lead to buffer overflows.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
V
Ville Vesilehto committed
dff2b4756cedca462721dc9666a2fbc05d47b486
Parent: eef76c2
Committed by GitHub <noreply@github.com> on 4/29/2025, 8:17:50 AM