avformat/lmlm4: Eliminate some AVERROR(EIO)

Found by code review related to CID732224 Overflowed constant

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-07-13 09:16:48 +02:00
parent 239f7e6c71
commit 191a685010
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -94,16 +94,16 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt)
if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) { if (frame_type > LMLM4_MPEG1L2 || frame_type == LMLM4_INVALID) {
av_log(s, AV_LOG_ERROR, "invalid or unsupported frame_type\n"); 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) { if (packet_size > LMLM4_MAX_PACKET_SIZE || packet_size<=8) {
av_log(s, AV_LOG_ERROR, "packet size %d is invalid\n", packet_size); 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; frame_size = packet_size - 8;
if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
return AVERROR(EIO); return ret < 0 ? ret : AVERROR(EIO);
avio_skip(pb, padding); avio_skip(pb, padding);