Skip to content
This repository was archived by the owner on Jun 24, 2023. It is now read-only.

Commit b5d834f

Browse files
committed
improve untrusted width / height / fps checks
Signed-off-by: jampe <daniel@jampen.net>
1 parent 803d66b commit b5d834f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

receiver/receiver.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,18 @@ def read_video_parameters() -> (int, int, int):
6565
del untrusted_input
6666

6767
screen = Gdk.Display().get_default().get_default_screen()
68-
if untrusted_width > screen.width() or untrusted_height > screen.height() or untrusted_fps > 4096:
69-
print('warning: excessive width, height, and/or fps')
68+
if untrusted_width > screen.width() or untrusted_height > screen.height():
69+
raise RuntimeError('excessive width, height')
70+
71+
if untrusted_fps > 60:
72+
raise RuntimeError('excessive fps')
73+
74+
if untrusted_width > (3840 * 3):
75+
raise RuntimeError('excessive width')
76+
77+
if untrusted_height > (2160 * 3):
78+
raise RuntimeError('excessive height')
79+
7080
width, height, fps = untrusted_width, untrusted_height, untrusted_fps
7181
del untrusted_width, untrusted_height, untrusted_fps
7282

0 commit comments

Comments
 (0)