[FFmpeg-devel] [PATCH 10/22] avformat/nsvdec: Check asize for PCM

Michael Niedermayer michael at niedermayer.cc
Fri Jul 12 02:34:04 EEST 2024


Fixes: CID1604527 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/nsvdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 3b8f812aa5e..dd01765d7d2 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -617,7 +617,7 @@ null_chunk_retry:
         pkt = &nsv->ahead[NSV_ST_AUDIO];
         /* read raw audio specific header on the first audio chunk... */
         /* on ALL audio chunks ?? seems so! */
-        if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
+        if (asize >= 4 && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
             uint8_t bps;
             uint8_t channels;
             uint16_t samplerate;
-- 
2.45.2



More information about the ffmpeg-devel mailing list