Skip to content

Commit 0a62e71

Browse files
committed
fix detection of invalid UVLC codes in read_scaling_list(). Fixes #361
1 parent 2f0430e commit 0a62e71

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

libde265/sps.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,16 @@ de265_error read_scaling_list(bitreader* br, const seq_parameter_set* sps,
901901
if (!scaling_list_pred_mode_flag) {
902902
int scaling_list_pred_matrix_id_delta = get_uvlc(br);
903903

904-
if (sizeId==3) {
905-
// adapt to our changed matrixId for size 3
906-
scaling_list_pred_matrix_id_delta *= 3;
907-
}
908-
909-
if (scaling_list_pred_matrix_id_delta == UVLC_ERROR ||
910-
scaling_list_pred_matrix_id_delta > matrixId) {
904+
if (scaling_list_pred_matrix_id_delta == UVLC_ERROR) {
905+
return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
906+
}
907+
908+
if (sizeId == 3) {
909+
// adapt to our changed matrixId for size 3
910+
scaling_list_pred_matrix_id_delta *= 3;
911+
}
912+
913+
if (scaling_list_pred_matrix_id_delta > matrixId) {
911914
return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE;
912915
}
913916

0 commit comments

Comments
 (0)