1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix out of range enum casts in deSerialize functions (#14090)

This commit is contained in:
cx384 2024-01-17 20:05:46 +01:00 committed by GitHub
parent 0383c44f0d
commit 2ea8d9ca11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 138 additions and 77 deletions

View file

@ -84,6 +84,8 @@ T TweenedParameter<T>::blend(float fac) const
fac *= myrand_range(0.7f, 1.0f);
}
}
case TweenStyle::TweenStyle_END:
break;
}
if (fac>1.f)
fac = 1.f;
@ -110,6 +112,8 @@ template<typename T>
void TweenedParameter<T>::deSerialize(std::istream &is)
{
style = static_cast<TweenStyle>(readU8(is));
if (style >= TweenStyle::TweenStyle_END)
style = TweenStyle::fwd;
reps = readU16(is);
beginning = readF32(is);
start.deSerialize(is);