mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
lavc/utils: improve feedback in case of invalid packet size
This commit is contained in:
parent
c58d535b2f
commit
47c9887eca
@ -1395,8 +1395,13 @@ free_and_end:
|
||||
|
||||
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
|
||||
{
|
||||
if (size < 0 || avpkt->size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Size %d invalid\n", size);
|
||||
if (avpkt->size < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %d (max allowed is %d)\n",
|
||||
size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user