[FFmpeg-devel] [PATCH 2/3] avformat/lmlm4: Eliminate some AVERROR(EIO)

Michael Niedermayer michael at niedermayer.cc
Sat Jul 13 18:51:04 EEST 2024


Found by code review related to CID732224 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/lmlm4.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index c8355e7a8d6..cec2f7ca051 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -94,16 +94,16 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) {
         av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n");
-        return AVERROR(EIO);
+        return AVERROR_INVALIDDATA;
     }
     if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) {
         av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size);
-        return AVERROR(EIO);
+        return AVERROR_INVALIDDATA;
     }
 
     frame_size  = packet_size - 8;
     if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
-        return AVERROR(EIO);
+        return ret < 0 ? ret : AVERROR(EIO);
 
     avio_skip(pb, padding);
 
-- 
2.45.2



More information about the ffmpeg-devel mailing list