Skip to content

Commit 3a1565c

Browse files
committed
set max icc profile size
1 parent f1285ec commit 3a1565c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

color_info.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include "color_info.hpp"
22
#include <lcms2.h>
33

4+
// Maximum ICC profile size we're willing to parse (1MB)
5+
static const size_t MAX_ICC_PROFILE_SIZE = 1024 * 1024;
6+
47
// Check if ICC profile indicates HDR (PQ or HLG transfer function)
58
bool is_hdr_transfer_function(const uint8_t* icc_data, size_t icc_len)
69
{
7-
if (!icc_data || icc_len == 0) {
10+
if (!icc_data || icc_len == 0 || icc_len > MAX_ICC_PROFILE_SIZE) {
811
return false;
912
}
1013

0 commit comments

Comments
 (0)