diff mbox series

[FFmpeg-devel,3/3] avcodec/j2kenc: Check for av_strtok() failure

Message ID 20210518213910.28732-3-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/3] avfilter/avfiltergraph: Remove NULL checks after dereferences
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 18, 2021, 9:39 p.m. UTC
Fixes: CID1466601 Dereference null return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/j2kenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 82ad3284b5..2ebef53388 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1681,7 +1681,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 {