On OS X, we often get stack trace in a report that ends with a 0x0 frame:
================================================================= ==56615==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200000eed0 at pc 0x00010aa33359 bp 0x7fff552057f0 sp 0x7fff552023a0 READ of size 2 at 0x60200000eed0 thread T0 #0 0x10aa33358 in printf_common(void*, char const*, __va_list_tag*) sanitizer_common_interceptors_format.inc:545 #1 0x10aa31e24 in wrap_vprintf sanitizer_common_interceptors.inc:1099 #2 0x7fff8c4375ac in start (libdyld.dylib+0x35ac) #3 0x0 (<unknown module>)
To get rid of it, let's trim the stack trace when we find a close-to-zero value, which is obviously not a valid PC.