Merge pull request #23283 from vrabaud:5_overflow

Fix signed integer overflow.
pull/23680/head
Alexander Smorkalov 2 years ago committed by GitHub
commit a792252b55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/imgproc/src/stb_truetype.cpp

@ -3530,11 +3530,14 @@ STBTT_DEF unsigned char* stbtt_GetGlyphBitmapSubpixelRealloc(const stbtt_fontinf
iy1 = STBTT_max(iy1, y);
}
}
int w = ix1 - ix0 + 1, h = iy1 - iy0 + 1;
int w, h;
if (ix0 == INT_MAX || iy0 == INT_MAX || ix1 == INT_MIN || iy1 == INT_MIN ) {
w = h = 0;
ix0 = pad_x;
iy0 = pad_y;
} else {
w = ix1 - ix0 + 1;
h = iy1 - iy0 + 1;
}
if (width) *width = w;
if (height) *height = h;

Loading…
Cancel
Save