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,13 +650,16 @@ public:
} }
case FLOAT: { case FLOAT: {
union IntFloat { if (offset + 3 < tag->second.value.size()) {
std::uint32_t i; union IntFloat {
float f; std::uint32_t i;
} conv; float f;
} conv;
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: {