aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-09 17:08:03 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-09 20:18:54 +0200
commit9a0e20817aeedbd11fb019e35bae00c2a12cc3e3 (patch)
tree6e7f57f9a05f002efeaebad1498abd95058767e2 /libavcodec/utils.c
parenta5615b82eb116e9fd0f71f2b03c333cc31ab706a (diff)
downloadffmpeg-9a0e20817aeedbd11fb019e35bae00c2a12cc3e3.tar.gz
avcodec/util: Make size argument of ff_alloc_packet2() int64_t
This ensures that huge sizes dont get truncated before the check in ff_alloc_packet2() Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 30bc5222da..7f361ef876 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1425,14 +1425,14 @@ free_and_end:
goto end;
}
-int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
+int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t 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",
+ av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n",
size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
return AVERROR(EINVAL);
}
@@ -1456,7 +1456,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (avpkt->size < size) {
- av_log(avctx, AV_LOG_ERROR, "User packet is too small (%d < %d)\n", avpkt->size, size);
+ av_log(avctx, AV_LOG_ERROR, "User packet is too small (%d < %"PRId64")\n", avpkt->size, size);
return AVERROR(EINVAL);
}
@@ -1472,7 +1472,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
} else {
int ret = av_new_packet(avpkt, size);
if (ret < 0)
- av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %d\n", size);
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size);
return ret;
}
}