[FFmpeg-devel] [PATCH 3/3] avcodec/j2kenc: Check for av_strtok() failure
Michael Niedermayer
michael at niedermayer.cc
Wed May 19 00:39:10 EEST 2021
Fixes: CID1466601 Dereference null return value
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/j2kenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 {
--
2.17.1
More information about the ffmpeg-devel
mailing list