Add bound check

Thanks to Floessie
(https://github.com/Beep6581/RawTherapee/pull/5889#discussion_r622755925)
This commit is contained in:
Lawrence Lee
2023-02-15 21:34:03 -08:00
parent bfe6e0fb85
commit 8704c1dd86

View File

@@ -650,6 +650,7 @@ public:
} }
case FLOAT: { case FLOAT: {
if (offset + 3 < tag->second.value.size()) {
union IntFloat { union IntFloat {
std::uint32_t i; std::uint32_t i;
float f; float f;
@@ -658,6 +659,8 @@ public:
conv.i = sget4(tag->second.value.data() + offset); conv.i = sget4(tag->second.value.data() + offset);
return conv.f; // IEEE FLOATs are already C format, they just need a recast return conv.f; // IEEE FLOATs are already C format, they just need a recast
} }
return 0.0;
}
default: { default: {
return 0.0; return 0.0;