Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix READ heap-buffer-overflow errors reported by ASan.
When initializing fixed size structure fields from strings, the number of bytes copied needs to be the minimum of the structure field and the string byte count. Fixes the following class of errors found when running a version of class-dump build with ASan (Address Sanitizer): ==67822==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000095a0 at pc 0x0001068b4d2d bp 0x7fff595270b0 sp 0x7fff59526860 READ of size 16 at 0x6030000095a0 thread T0 #0 0x1068b4d2c in __asan_memcpy (libclang_rt.asan_osx_dynamic.dylib+0x40d2c) #1 0x106716ed4 in -[CDLCSegment initWithDataCursor:] (class-dump+0x100040ed4) #2 0x10672d82b in +[CDLoadCommand loadCommandWithDataCursor:] (class-dump+0x10005782b) ...
- Loading branch information