History

wayland: add some sanity checking when setting mastering luminance

Actually found a file in the wild that violated this which is a protocol error (fatal).

Dudemanguy committed 1 year ago

Commit 1a70de21 parent d26131e1 file · +9 −3Browse files

Unified · Split

video/out/wayland_common.c+9−3
@@ -2509,9 +2509,15 @@ static void set_color_management(struct vo_wayland_state *wl) · 2508 unmodified lines
25092509 hdr.prim.red.x * WAYLAND_COLOR_FACTOR, hdr.prim.red.y * WAYLAND_COLOR_FACTOR, hdr.prim.green.x * WAYLAND_COLOR_FACTOR,
25102510 hdr.prim.green.y * WAYLAND_COLOR_FACTOR, hdr.prim.blue.x * WAYLAND_COLOR_FACTOR, hdr.prim.blue.y * WAYLAND_COLOR_FACTOR,
25112511 hdr.prim.white.x * WAYLAND_COLOR_FACTOR, hdr.prim.white.y * WAYLAND_COLOR_FACTOR);
2512− wp_image_description_creator_params_v1_set_mastering_luminance(image_creator_params, hdr.min_luma * WAYLAND_MIN_LUM_FACTOR, hdr.max_luma);
2513− wp_image_description_creator_params_v1_set_max_cll(image_creator_params, hdr.max_cll);
2514− wp_image_description_creator_params_v1_set_max_fall(image_creator_params, hdr.max_fall);
2512+
2513+ if (hdr.min_luma < hdr.max_luma)
2514+ wp_image_description_creator_params_v1_set_mastering_luminance(image_creator_params, hdr.min_luma * WAYLAND_MIN_LUM_FACTOR, hdr.max_luma);
2515+
2516+ if (hdr.max_cll > hdr.min_luma && hdr.max_cll <= hdr.max_luma)
2517+ wp_image_description_creator_params_v1_set_max_cll(image_creator_params, hdr.max_cll);
2518+
2519+ if (hdr.max_fall > hdr.min_luma && hdr.max_fall <= hdr.max_luma && hdr.max_fall <= hdr.max_cll)
2520+ wp_image_description_creator_params_v1_set_max_fall(image_creator_params, hdr.max_fall);
25152521 }
25162522 struct wp_image_description_v1 *image_description = wp_image_description_creator_params_v1_create(image_creator_params);
25172523 wp_image_description_v1_add_listener(image_description, &image_description_listener, wl);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t