ref: bb045db2b479504702bf1f570476e2c3f0ceb678
parent: 98f3ddc8e94b8be31ebdeac52805a93cfab395e7
author: Mark Harris <mark.hsj@gmail.com>
date: Wed Mar 19 09:41:37 EDT 2025
opusenc: Fix support for small FLAC input files Broken by 5d0ac2030244b33bf12512267fe62ffe831bf105 Fixes https://github.com/xiph/opus-tools/issues/78 Resolves https://github.com/xiph/opus-tools/pull/95 Resolves https://github.com/xiph/opus-tools/pull/97
--- a/src/flac.c
+++ b/src/flac.c
@@ -80,7 +80,7 @@
flacfile *flac;
(void)decoder;
flac=(flacfile *)client_data;
- return feof(flac->f)?true:false;
+ return flac->bufpos>=flac->buflen&&feof(flac->f)?true:false;
}
/*Callback to process a metadata packet.*/
@@ -292,6 +292,7 @@
if(len<4)return 0;
/*Normal FLAC.*/
if(!memcmp(buf,"fLaC",4))return 1;
+ if(len<14)return 0;
if(!memcmp(buf,"ID3",3)){
int i;
int id3_len = 0;
--
⑨