Crash on malformed nif
The attached malformed nif file wants to allocate a ton of memory, and is thus leading to a crash:
$ ./niftest --input-file /tmp/openmw/test.nif
NIFFile Warning: Unsupported NIF version: 99.0.0.0. Proceed with caution!
File: /tmp/openmw/test.nif
=================================================================
==61547==ERROR: AddressSanitizer: allocator is out of memory trying to allocate 0x7fffffff8 bytes
#0 0x4f251d in operator new(unsigned long) (/home/jvoisin/dev/openmw/openmw/build_fuzz_asan_master/niftest+0x4f251d)
#1 0x5a3e0b in __gnu_cxx::new_allocator<Nif::Record*>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/new_allocator.h:115:27
#2 0x5a3e0b in std::allocator_traits<std::allocator<Nif::Record*> >::allocate(std::allocator<Nif::Record*>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:460:20
#3 0x5a3e0b in std::_Vector_base<Nif::Record*, std::allocator<Nif::Record*> >::_M_allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:346:20
#4 0x5a3e0b in std::vector<Nif::Record*, std::allocator<Nif::Record*> >::_M_default_append(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/vector.tcc:635:34
==61547==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: out-of-memory (/home/jvoisin/dev/openmw/openmw/build_fuzz_asan_master/niftest+0x4f251d) in operator new(unsigned long)
==61547==ABORTING
$
Edited by jvoisin