[FFmpeg-devel,v1,1/8] avformat/cinedec: check av_strdup() return value

Submitted by Steven Liu on Oct. 10, 2019, 3:40 a.m.

Details

Message ID 20191010034011.1205-1-lq@chinaffmpeg.org
State Accepted
Commit 25f5d67a316b6868b4358e0b908bc19f00b9d357
Headers show

Commit Message

Steven Liu Oct. 10, 2019, 3:40 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/cinedec.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Andreas Rheinhardt Oct. 10, 2019, 4:42 a.m.
Steven Liu:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/cinedec.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
> index d27ebbba7b..0f2453cdf5 100644
> --- a/libavformat/cinedec.c
> +++ b/libavformat/cinedec.c
> @@ -168,6 +168,10 @@ static int cine_read_header(AVFormatContext *avctx)
>      avio_skip(pb, 616); // Binning .. bFlipH
>      if (!avio_rl32(pb) ^ vflip) {
>          st->codecpar->extradata  = av_strdup("BottomUp");
> +        if (!st->codecpar->extradata) {
> +            st->codecpar->extradata_size = 0;
> +            return AVERROR(ENOMEM);
> +        }
>          st->codecpar->extradata_size  = 9;
>      }
>  
Isn't extradata supposed to be padded with
AV_INPUT_BUFFER_PADDING_SIZE zero bytes?

- Andreas

Patch hide | download patch | download mbox

diff --git a/libavformat/cinedec.c b/libavformat/cinedec.c
index d27ebbba7b..0f2453cdf5 100644
--- a/libavformat/cinedec.c
+++ b/libavformat/cinedec.c
@@ -168,6 +168,10 @@  static int cine_read_header(AVFormatContext *avctx)
     avio_skip(pb, 616); // Binning .. bFlipH
     if (!avio_rl32(pb) ^ vflip) {
         st->codecpar->extradata  = av_strdup("BottomUp");
+        if (!st->codecpar->extradata) {
+            st->codecpar->extradata_size = 0;
+            return AVERROR(ENOMEM);
+        }
         st->codecpar->extradata_size  = 9;
     }