mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-27 02:42:26 -04:00
frontend/widgets: Fix integer overflow
If the crop values combined are larger than the width or height of the source, an integer overflow will occur. This fix converts the width/height values to int, and then clamps any negative values to 0.
This commit is contained in:
@@ -414,8 +414,9 @@ static vec2 GetItemSize(obs_sceneitem_t *item)
|
||||
|
||||
obs_sceneitem_get_scale(item, &scale);
|
||||
obs_sceneitem_get_crop(item, &crop);
|
||||
size.x = float(obs_source_get_width(source) - crop.left - crop.right) * scale.x;
|
||||
size.y = float(obs_source_get_height(source) - crop.top - crop.bottom) * scale.y;
|
||||
size.x = fmaxf(float((int)obs_source_get_width(source) - crop.left - crop.right), 0.0f);
|
||||
size.y = fmaxf(float((int)obs_source_get_height(source) - crop.top - crop.bottom), 0.0f);
|
||||
vec2_mul(&size, &size, &scale);
|
||||
}
|
||||
|
||||
return size;
|
||||
|
||||
Reference in New Issue
Block a user