Skip to contentSkip to conversation

media: ccs: Fix CCS static data parsing for large block sizes

PATCH New Sakari Ailus 1 participant 1 message Dec 3, 2024

Subsystems (2)
lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

PATCH 1/1 media: ccs: Fix CCS static data parsing for large block sizes

The length field of the CCS static data blocks was mishandled, leading to wrong interpretation of the length header for blocks that are 16 kiB in size. Such large blocks are very, very rare and so this wasn't found earlier.

As the length is used as part of for input validation, the issue has no security implications.

Fixes a6b396f410b1 ("media: ccs: Add CCS static data parser library")
---
 drivers/media/i2c/ccs/ccs-data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-data.c +1 -1
index 08400edf77ce..9d42137f4799 100644
@@ -97,7 +97,7 @@ ccs_data_parse_length_specifier(const struct __ccs_data_length_specifier *__len,
 		plen = ((size_t)
 			(__len3->length[0] &
 			 ((1 << CCS_DATA_LENGTH_SPECIFIER_SIZE_SHIFT) - 1))
-			<< 16) + (__len3->length[0] << 8) + __len3->length[1];
+			<< 16) + (__len3->length[1] << 8) + __len3->length[2];
 		break;
 	}
 	default:
Signature · 1 line
2.39.5