1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Fix signed integer overflow.

The overflow happens for INT_MAX so the code just needs to be moved down.
This commit is contained in:
Vincent Rabaud
2023-02-20 23:52:22 +01:00
parent 23dec329b4
commit f7ce715596
+4 -1
View File
@@ -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;