Skip to content

Commit

Permalink
Cherry-pick 272448.9@safari-7618-branch (965fd49). https://bugs.webki…
Browse files Browse the repository at this point in the history
…t.org/show_bug.cgi?id=266695

    Potential 'overflow' issue commited to upstream libwebrtc
    rdar://119595026

    Reviewed by Jean-Yves Avenard.

    Cherry-picking of webmproject/libvpx@193b151

    * Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/test/encode_api_test.cc:
    * Source/ThirdParty/libwebrtc/Source/third_party/libvpx/source/libvpx/vp8/encoder/encodeframe.c:
    (encode_mb_row):

    Canonical link: https://commits.webkit.org/272448.9@safari-7618-branch

Canonical link: https://commits.webkit.org/266719.382@webkitglib/2.42
  • Loading branch information
youennf authored and aperezdc committed Mar 14, 2024
1 parent d058394 commit 2134a7c
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,21 @@ static void encode_mb_row(VP8_COMP *cpi, VP8_COMMON *cm, int mb_row,
x->active_ptr = cpi->active_map + map_index + mb_col;

if (cm->frame_type == KEY_FRAME) {
*totalrate += vp8cx_encode_intra_macroblock(cpi, x, tp);
const int intra_rate_cost = vp8cx_encode_intra_macroblock(cpi, x, tp);
if (INT_MAX - *totalrate > intra_rate_cost)
*totalrate += intra_rate_cost;
else
*totalrate = INT_MAX;
#ifdef MODE_STATS
y_modes[xd->mbmi.mode]++;
#endif
} else {
*totalrate += vp8cx_encode_inter_macroblock(
const int inter_rate_cost = vp8cx_encode_inter_macroblock(
cpi, x, tp, recon_yoffset, recon_uvoffset, mb_row, mb_col);
if (INT_MAX - *totalrate > inter_rate_cost)
*totalrate += inter_rate_cost;
else
*totalrate = INT_MAX;

#ifdef MODE_STATS
inter_y_modes[xd->mbmi.mode]++;
Expand Down

0 comments on commit 2134a7c

Please sign in to comment.