Skip to content

Commit 33817ca

Browse files
committed
Ensure visibleRect can't be negative
This fixes #513.
1 parent fd0c13f commit 33817ca

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

index.src.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,8 +4100,10 @@
41004100
(with |init|, |frame|, |defaultVisibleRect|, |baseRotation|, |baseFlip|,
41014101
|defaultDisplayWidth| and |defaultDisplayHeight|)
41024102
:: 1. Let |visibleRect| be |defaultVisibleRect|.
4103-
2. If |init|.{{VideoFrameInit/visibleRect}} [=map/exists=], assign it to
4104-
|visibleRect|.
4103+
2. If |init|.{{VideoFrameInit/visibleRect}} [=map/exists=]:
4104+
1. If any attribute of |init|.{{VideoFrameInit/visibleRect}} is negative or
4105+
not finite, throw a {{TypeError}}.
4106+
2. Assign |init|.{{VideoFrameInit/visibleRect}} to |visibleRect|.
41054107
3. Assign |visibleRect|'s {{DOMRect/x}}, {{DOMRect/y}}, {{DOMRect/width}},
41064108
and {{DOMRect/height}}, to |frame|'s {{VideoFrame/[[visible left]]}},
41074109
{{VideoFrame/[[visible top]]}}, {{VideoFrame/[[visible width]]}}, and
@@ -4235,15 +4237,16 @@
42354237
|overrideRect|, |codedWidth|, |codedHeight|, and |format|)
42364238
:: 1. Let |sourceRect| be |defaultRect|
42374239
2. If |overrideRect| is not `undefined`:
4238-
1. If either of |overrideRect|.{{DOMRectInit/width}} or
4240+
1. If any attribute of |overrideRect| is negative or not finite, return a {{TypeError}}.
4241+
2. If either of |overrideRect|.{{DOMRectInit/width}} or
42394242
{{DOMRectInit/height}} is `0`, return a {{TypeError}}.
4240-
2. If the sum of |overrideRect|.{{DOMRectInit/x}} and
4243+
3. If the sum of |overrideRect|.{{DOMRectInit/x}} and
42414244
|overrideRect|.{{DOMRectInit/width}} is greater than
42424245
|codedWidth|, return a {{TypeError}}.
4243-
3. If the sum of |overrideRect|.{{DOMRectInit/y}} and
4246+
4. If the sum of |overrideRect|.{{DOMRectInit/y}} and
42444247
|overrideRect|.{{DOMRectInit/height}} is greater than
42454248
|codedHeight|, return a {{TypeError}}.
4246-
4. Assign |overrideRect| to |sourceRect|.
4249+
5. Assign |overrideRect| to |sourceRect|.
42474250
3. Let |validAlignment| be the result of running the
42484251
[=VideoFrame/Verify Rect Offset Alignment=] algorithm with |format| and
42494252
|sourceRect|.

0 commit comments

Comments
 (0)