Skip to content

Commit 33b9a4a

Browse files
committed
Work around i386 ASAN null pointer bug
For some reason, i386 ASAN does not copy a pointer somewhere in the code. Using gdb I get a mention of a synthetic pointer, so perhaps the compiler instrumented with ASAN thinks this pointer isn't used. Anyway, commit adds a check for that null pointer which isn't necessary otherwise and is only activated for i386 ASAN. Credit: Oss-Fuzz Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58524
1 parent 215d1aa commit 33b9a4a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/flac/encode.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,12 @@ static void static_metadata_clear(static_metadata_t *m)
16351635
static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetadata *d, FLAC__bool needs_delete)
16361636
{
16371637
void *x;
1638+
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
1639+
#ifdef __i386__
1640+
/* Work around i386 ASAN bug */
1641+
if(0 == d) return true;
1642+
#endif
1643+
#endif
16381644
if(0 == (x = safe_realloc_nofree_muladd2_(m->metadata, sizeof(*m->metadata), /*times (*/m->num_metadata, /*+*/1/*)*/)))
16391645
return false;
16401646
m->metadata = (FLAC__StreamMetadata**)x;

0 commit comments

Comments
 (0)