obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Division by zero when transforming sources with no width / height

Open notr1ch opened this issue 3 years ago • 0 comments

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

29.0.0-beta2

OBS Studio Version (Other)

No response

OBS Studio Log URL

N/A

OBS Studio Crash Log URL

No response

Expected Behavior

No division by zero.

Current Behavior

Division by zero causing NaNs to propagate through scaling / transform code and eventually causing undefined behavior when cast to int. Might be one of the reasons why users sometimes "lose" their sources and have to Ctrl+F them.

libobs/obs-scene.c:407:44: runtime error: nan is outside the range of representable values of type 'int'
libobs/obs-scene.c:408:9: runtime error: nan is outside the range of representable values of type 'int'
libobs/obs-scene.c:459:8: runtime error: -nan is outside the range of representable values of type 'unsigned int'
libobs/obs-scene.c:460:8: runtime error: -nan is outside the range of representable values of type 'unsigned int'
libobs/obs-scene.c:488:43: runtime error: -nan is outside the range of representable values of type 'int'
libobs/obs-scene.c:488:57: runtime error: -nan is outside the range of representable values of type 'int'

(from UBSan)

Steps to Reproduce

  1. Add invalid source (e.g. game capture without a game)
  2. Edit transform, Ctrl+F, etc.

Anything else we should know?

Not sure what the best fix is for this, wanted to at least document this in an issue before I forget about it.

notr1ch avatar Dec 24 '22 23:12 notr1ch