0607dc450c
The MSVC fallback path in safeAddToBufferSize() performed unchecked arithmetic (type_size*nr*nc) on attacker-controlled values read from .mjb binary model files. This could cause integer overflow, leading to an undersized heap allocation followed by a heap buffer overflow when data is copied into the buffer. The fix adds manual overflow detection using SIZE_MAX/INTPTR_MAX comparisons, matching the behavior of the existing __builtin_*_overflow path used on GCC/Clang. Also adds a regression test that crafts a binary model buffer with overflow-inducing size fields and asserts safe rejection.