tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

input_frame_validation_vp9.patch (1566B)


      1 # HG changeset patch
      2 # User Randell Jesup <rjesup@jesup.org>
      3 # Parent  87841f3bfc9d99a37e31cd43b2e2d03c325af84f
      4 Bug 1315288: Add input checks for VP9 r=rillian
      5 
      6 diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
      7 --- a/vp9/vp9_cx_iface.c
      8 +++ b/vp9/vp9_cx_iface.c
      9 @@ -1372,13 +1372,22 @@ static vpx_codec_err_t encoder_encode(vpx_codec_alg_priv_t *ctx,
     10           timebase_units_to_ticks(timestamp_ratio, pts + duration);
     11       res = image2yuvconfig(img, &sd);
     12 
     13 -      // Store the original flags in to the frame buffer. Will extract the
     14 -      // key frame flag when we actually encode this frame.
     15 -      if (vp9_receive_raw_frame(cpi, flags | ctx->next_frame_flags, &sd,
     16 +      if (sd.y_width != ctx->cfg.g_w || sd.y_height != ctx->cfg.g_h) {
     17 +        /* from vpx_encoder.h for g_w/g_h:
     18 +           "Note that the frames passed as input to the encoder must have this
     19 +           resolution"
     20 +        */
     21 +        ctx->base.err_detail = "Invalid input frame resolution";
     22 +        res = VPX_CODEC_INVALID_PARAM;
     23 +      } else {
     24 +        // Store the original flags in to the frame buffer. Will extract the
     25 +        // key frame flag when we actually encode this frame.
     26 +        if (vp9_receive_raw_frame(cpi, flags | ctx->next_frame_flags, &sd,
     27                                 dst_time_stamp, dst_end_time_stamp)) {
     28 -        res = update_error_state(ctx, &cpi->common.error);
     29 +          res = update_error_state(ctx, &cpi->common.error);
     30 +        }
     31 +        ctx->next_frame_flags = 0;
     32       }
     33 -      ctx->next_frame_flags = 0;
     34     }
     35 
     36     cx_data = ctx->cx_data;