diff mbox series

[FFmpeg-devel,07/17] avformat/mxfenc: Error out when receiving invalid data

Message ID AM7PR03MB6660DC7BD2AA2D31CE904F188F929@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,01/17] avformat/mxfenc: Auto-insert h264_mp4toannexb BSF if needed
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Nov. 9, 2021, 6:01 p.m. UTC
(Unless the packet has a size of zero, the packet will run afoul
of the cbr_index check a few lines below.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mxfenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tomas Härdin Nov. 9, 2021, 9:22 p.m. UTC | #1
tis 2021-11-09 klockan 19:01 +0100 skrev Andreas Rheinhardt:
> (Unless the packet has a size of zero, the packet will run afoul
> of the cbr_index check a few lines below.)
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/mxfenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index a6535eb43f..c20ba9bfca 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -2151,7 +2151,7 @@ static int mxf_parse_dv_frame(AVFormatContext
> *s, AVStream *st, AVPacket *pkt)
>  
>      // Check for minimal frame size
>      if (pkt->size < 120000)
> -        return -1;
> +        return 0;

Might be nicer to have negative return value mean error, just like
everywhere else, and change the code further down accordingly. -1 is a
crappy return value for mxf_write_packet() I think. But then the other
parsing functions should change at the same time. So let's not hold
this patch up with that. Looks OK for now.

/Tomas
diff mbox series

Patch

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index a6535eb43f..c20ba9bfca 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2151,7 +2151,7 @@  static int mxf_parse_dv_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt)
 
     // Check for minimal frame size
     if (pkt->size < 120000)
-        return -1;
+        return 0;
 
     apt      = pkt->data[4] & 0x7;
     vs_pack  = pkt->data + 80*5 + 48;