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

Michael Niedermayer git at videolan.org
Wed Sep 8 22:42:59 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Tue May 18 22:44:19 2021 +0200| [09f47af7473524fedb1cf0fa17d627c90dac991d] | 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>
(cherry picked from commit 6a6a765fa4ca57143453093af3bf8d1c8a52d0b0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index e3c5a32188..212b9601c4 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1679,7 +1679,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