[FFmpeg-cvslog] avcodec/msrleenc: Check allocation

Andreas Rheinhardt git at videolan.org
Mon Jul 17 17:31:31 EEST 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Jul 16 16:30:08 2023 +0200| [3c642af8e03e545371d955f89a200812d869a7b4] | committer: Andreas Rheinhardt

avcodec/msrleenc: Check allocation

Fixes Coverity issue #1538297.

Reviewed-by: Tomas Härdin <git at haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c642af8e03e545371d955f89a200812d869a7b4
---

 libavcodec/msrleenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/msrleenc.c b/libavcodec/msrleenc.c
index e48d11a0f7..264d57e178 100644
--- a/libavcodec/msrleenc.c
+++ b/libavcodec/msrleenc.c
@@ -250,6 +250,8 @@ static int msrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 
     if (pict->data[1]) {
         uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+        if (!side_data)
+            return AVERROR(ENOMEM);
         memcpy(side_data, pict->data[1], AVPALETTE_SIZE);
     }
 



More information about the ffmpeg-cvslog mailing list