Skip to content

Commit ce91056

Browse files
committed
Work around i386 ASAN fseek bug
For some reason, i386 ASAN's fseek does not have large file support, and off_t is actually a 32-bit int
1 parent e50c876 commit ce91056

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/flac/encode.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,6 +2892,13 @@ FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
28922892
static uint8_t dump[8192];
28932893
struct flac_stat_s stb;
28942894

2895+
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
2896+
#ifdef __i386__
2897+
/* Work around i386 ASAN bug */
2898+
if(offset > (FLAC__uint64)(INT32_MAX)) return false;
2899+
#endif
2900+
#endif
2901+
28952902
if(flac_fstat(fileno(f), &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFREG)
28962903
{
28972904
if(fseeko(f, offset, SEEK_CUR) == 0)

0 commit comments

Comments
 (0)