fix(obs-studio): reject non-finite geometry in source transforms#397
fix(obs-studio): reject non-finite geometry in source transforms#397santhreal wants to merge 3 commits into
Conversation
validate_position accepted NaN coordinates into project JSON. size/crop converted NaN via int() with a cryptic error. Reject non-finite values up front, matching validate_range.
validate_position/size/crop were unused while add_source and transform_source accepted NaN into project JSON. Call the validators from those paths and cover the live transform entrypoint.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 516177b974
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """Validate and normalize a size dict.""" | ||
| w = int(size.get("width", 1920)) | ||
| h = int(size.get("height", 1080)) | ||
| width_raw = float(size.get("width", 1920)) |
There was a problem hiding this comment.
Preserve integer geometry without float rounding
For finite integer dimensions above IEEE-754's exact range, this new intermediate float conversion silently changes the requested geometry before int restores it: for example, width=2**53 + 1 is stored as 2**53, whereas the previous implementation preserved the integer exactly. This affects API callers and CLI-parsed integer sizes, and the identical conversion in validate_crop corrupts large crop values as well; validate finiteness without routing already-integral inputs through float.
Useful? React with 👍 / 👎.
Problem
add_source/transform_sourceacceptedNaNposition coordinates into project JSON. Size/crop hit crypticint(NaN)errors instead of a clear validation failure.Repro
Fix
Validate position/size/crop with
math.isfiniteand call those helpers from the live source paths (complements #396 which coversvalidate_rangeonly).