In `HL1MDLLoader::read_animations`, the arrays for `scene_->mAnimations` and `scene_animation->mChannels` were allocated using `new T*[count]`. This performs default initialization, which leaves the pointer elements with indeterminate (garbage) values. If an exception (such as a `DeadlyImportError` from malformed input) is thrown during the loop populating these arrays, the `aiScene` or `aiAnimation` destructors are invoked during stack unwinding. These destructors iterate through the allocated arrays and call `delete` on each element. Because the arrays contained garbage values for indices not yet reached by the loader, the destructor attempted to delete invalid memory addresses, leading to a segmentation fault. This patch changes the allocations to use value-initialization (`new T*[count]()`), ensuring all pointers are initialized to `nullptr`. Since `delete nullptr` is a safe no-op, the destructors can now safely clean up partially initialized objects during an exception. Fixes: https://issues.oss-fuzz.com/issues/483188619 Co-authored-by: CodeMender <codemender-patching@google.com> Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>
58 KiB
58 KiB