[FFmpeg-cvslog] avcodec/j2kenc: Check for av_strtok() failure

Michael Niedermayer git at videolan.org
Sat Jul 3 19:13:25 EEST 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue May 18 22:44:19 2021 +0200| [6a6a765fa4ca57143453093af3bf8d1c8a52d0b0] | committer: Michael Niedermayer

avcodec/j2kenc: Check for av_strtok() failure

Fixes: CID1466601 Dereference null return value

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/j2kenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index c53c34f412..83f7d6efbf 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1682,7 +1682,7 @@ static int parse_layer_rates(Jpeg2000EncoderContext *s)
     }
 
     token = av_strtok(s->lr_str, ",", &saveptr);
-    if (rate = strtol(token, NULL, 10)) {
+    if (token && (rate = strtol(token, NULL, 10))) {
             s->layer_rates[0] = rate <= 1 ? 0:rate;
             nlayers++;
     } else {



More information about the ffmpeg-cvslog mailing list