avcodec/j2kenc: Check for av_strtok() failure

Fixes: CID1466601 Dereference null return value

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/359/head
Michael Niedermayer 4 years ago
parent 9d40782088
commit 6a6a765fa4
  1. 2
      libavcodec/j2kenc.c

@ -1682,7 +1682,7 @@ static int parse_layer_rates(Jpeg2000EncoderContext *s)
} }
token = av_strtok(s->lr_str, ",", &saveptr); 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; s->layer_rates[0] = rate <= 1 ? 0:rate;
nlayers++; nlayers++;
} else { } else {

Loading…
Cancel
Save