kMaxAllowedMallocSize is pretty much arbitrary. It looks like you are running with allocator_may_return_null=1 (not the default!), and your program does not handle malloc() returning NULL.
On Sat, Dec 1, 2018 at 7:47 AM xfan <[email protected]> wrote: > > Asan reports the following error: > > ==6113== WARNING: AddressSanitizer failed to allocate 0x000d5b0fd480 bytes > ==6113== WARNING: AddressSanitizer failed to allocate 0x000d5b0fd480 bytes > ==6113== WARNING: AddressSanitizer failed to allocate 0x000b8f430280 bytes > ==6113== WARNING: AddressSanitizer failed to allocate 0x000b8f430280 bytes > ================================================================= > ==6113== ERROR: AddressSanitizer: unknown-crash on address 0x601c031ef620 at > pc 0x7fdcd413d371 bp 0x7fd890924d00 sp 0x7fd890924cd8 > READ of size 161 at 0x601c031ef620 thread T976 > ... > > question #1: why it is "unknown-crash" not "heap-buffer-overflow" etc. > meaningful error? The memory content is as below. ipString=0x601c031ef620 > '\b' <repeats 160 times> > > 0x601c031ef620: 0x0808080808080808 0x0808080808080808 > 0x601c031ef630: 0x0808080808080808 0x0808080808080808 > 0x601c031ef640: 0x0808080808080808 0x0808080808080808 > 0x601c031ef650: 0x0808080808080808 0x0808080808080808 > 0x601c031ef660: 0x0808080808080808 0x0808080808080808 > 0x601c031ef670: 0x0808080808080808 0x0808080808080808 > 0x601c031ef680: 0x0808080808080808 0x0808080808080808 > 0x601c031ef690: 0x0808080808080808 0x0808080808080808 > 0x601c031ef6a0: 0x0808080808080808 0x0808080808080808 > 0x601c031ef6b0: 0x0808080808080808 0x0808080808080808 > 0x601c031ef6c0: 0x0000000000000000 > > > > question #2 what does "failed to allocate" means? and will it cause the above > "unknown-crash" ? > Seems my machine is not running out of memory? The program doesn't reach > vm.max_map_count and /proc/sys/vm/overcommit_memory is set to 0. > I checked the sour code it say: > if (size > kMaxAllowedMallocSize || needed_size > kMaxAllowedMallocSize) { > Report("WARNING: AddressSanitizer failed to allocate %p bytes\n", > > How is the kMaxAllowedMallocSize decided? > > Thanks. > Xingyan > > > > -- > You received this message because you are subscribed to the Google Groups > "address-sanitizer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
