Fixes: out of array access Fixes: 62603/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5837632490569728
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -2043,9 +2043,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, · 2042 unmodified lines | ||
| 2043 | 2043 | } |
| 2044 | 2044 | if (i < current->pps_num_slices_in_pic_minus1) { |
| 2045 | 2045 | if (current->pps_tile_idx_delta_present_flag) { |
| 2046 | + // Two conditions must be met: | |
| 2047 | + // 1. −NumTilesInPic + 1 <= pps_tile_idx_delta_val[i] <= NumTilesInPic − 1 | |
| 2048 | + // 2. 0 <= tile_idx + pps_tile_idx_delta_val[i] <= NumTilesInPic − 1 | |
| 2049 | + // Combining these conditions yields: -tile_idx <= pps_tile_idx_delta_val[i] <= NumTilesInPic - 1 - tile_idx | |
| 2046 | 2050 | ses(pps_tile_idx_delta_val[i], |
| 2047 | − -current->num_tiles_in_pic + 1, | |
| 2048 | − current->num_tiles_in_pic - 1, 1, i); | |
| 2051 | + -tile_idx, current->num_tiles_in_pic - 1 - tile_idx, 1, i); | |
| 2049 | 2052 | if (current->pps_tile_idx_delta_val[i] == 0) { |
| 2050 | 2053 | av_log(ctx->log_ctx, AV_LOG_ERROR, |
| 2051 | 2054 | "pps_tile_idx_delta_val[i] shall not be equal to 0.\n"); |