You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
h264_mp4toannexb_filter: pass error code through.
Bug-Found-by and Suggested bugfix: Tanami, Ohad Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -63,6 +63,7 @@ static int h264_mp4toannexb_filter(AVBitStreamFilterContext *bsfc,
|
|||||||
int32_t nal_size;
|
int32_t nal_size;
|
||||||
uint32_t cumul_size = 0;
|
uint32_t cumul_size = 0;
|
||||||
const uint8_t *buf_end = buf + buf_size;
|
const uint8_t *buf_end = buf + buf_size;
|
||||||
|
int ret = AVERROR(EINVAL);
|
||||||
|
|
||||||
/* nothing to filter */
|
/* nothing to filter */
|
||||||
if (!avctx->extradata || avctx->extradata_size < 6) {
|
if (!avctx->extradata || avctx->extradata_size < 6) {
|
||||||
@@ -137,6 +138,7 @@ pps:
|
|||||||
*poutbuf_size = 0;
|
*poutbuf_size = 0;
|
||||||
*poutbuf = NULL;
|
*poutbuf = NULL;
|
||||||
do {
|
do {
|
||||||
|
ret= AVERROR(EINVAL);
|
||||||
if (buf + ctx->length_size > buf_end)
|
if (buf + ctx->length_size > buf_end)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@@ -155,15 +157,15 @@ pps:
|
|||||||
|
|
||||||
/* prepend only to the first type 5 NAL unit of an IDR picture */
|
/* prepend only to the first type 5 NAL unit of an IDR picture */
|
||||||
if (ctx->first_idr && unit_type == 5) {
|
if (ctx->first_idr && unit_type == 5) {
|
||||||
if (alloc_and_copy(poutbuf, poutbuf_size,
|
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
|
||||||
avctx->extradata, avctx->extradata_size,
|
avctx->extradata, avctx->extradata_size,
|
||||||
buf, nal_size) < 0)
|
buf, nal_size)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
ctx->first_idr = 0;
|
ctx->first_idr = 0;
|
||||||
} else {
|
} else {
|
||||||
if (alloc_and_copy(poutbuf, poutbuf_size,
|
if ((ret=alloc_and_copy(poutbuf, poutbuf_size,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
buf, nal_size) < 0)
|
buf, nal_size)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (!ctx->first_idr && unit_type == 1)
|
if (!ctx->first_idr && unit_type == 1)
|
||||||
ctx->first_idr = 1;
|
ctx->first_idr = 1;
|
||||||
@@ -178,7 +180,7 @@ pps:
|
|||||||
fail:
|
fail:
|
||||||
av_freep(poutbuf);
|
av_freep(poutbuf);
|
||||||
*poutbuf_size = 0;
|
*poutbuf_size = 0;
|
||||||
return AVERROR(EINVAL);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVBitStreamFilter ff_h264_mp4toannexb_bsf = {
|
AVBitStreamFilter ff_h264_mp4toannexb_bsf = {
|
||||||
|
Reference in New Issue
Block a user