Skip to content

Commit 7f772ab

Browse files
committed
coder options: disallow opts like 01,10 etc.
check if the option string is really one character
1 parent 9fc8283 commit 7f772ab

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/gpujpeg_decoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ gpujpeg_decoder_set_option(struct gpujpeg_decoder* decoder, const char *opt, con
484484
return GPUJPEG_ERROR;
485485
}
486486
if ( strcmp(opt, GPUJPEG_DECODER_OPT_TGA_RLE) == 0 ) {
487-
if ( val[0] != '0' && val[0] != '1' ) {
487+
if ( (val[0] != '0' && val[0] != '1') || val[1] != '\0' ) {
488488
ERROR_MSG("Unexpeceted value %s for " GPUJPEG_DECODER_OPT_TGA_RLE "\n", val);
489489
return GPUJPEG_ERROR;
490490
}

src/gpujpeg_encoder.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ gpujpeg_encoder_set_option(struct gpujpeg_encoder* encoder, const char *opt, con
653653
return GPUJPEG_ERROR;
654654
}
655655
if ( strcmp(opt, GPUJPEG_ENCODER_OPT_OUT_PINNED) == 0 ) {
656-
if ( val[0] != '0' && val[0] != '1' ) {
656+
if ( (val[0] != '0' && val[0] != '1') || val[1] != '\0' ) {
657657
ERROR_MSG("Unexpeceted value %s for " GPUJPEG_ENCODER_OPT_OUT_PINNED "\n", val);
658658
return GPUJPEG_ERROR;
659659
}

0 commit comments

Comments
 (0)