Fix potential integer overflows identified by Coverity

Convert ODK_LAST_STRESSABLE_TYPE to an aliased enum value so that
ODK_FieldLength always returns a valid value instead of SIZE_MAX.

PiperOrigin-RevId: 602823670
Change-Id: I7a843cacca8201677c0f31249112c04f6c3e04cb
This commit is contained in:
Googler
2024-01-30 13:26:44 -08:00
committed by Robert Shih
parent b239b11b60
commit e53e8ced89
4 changed files with 7 additions and 9 deletions

View File

@@ -28,7 +28,7 @@ enum ODK_FieldType {
ODK_HASH,
// The "stressable" types are the ones we can put in a stress test that packs
// and unpacks random data and can expect to get back the same thing.
ODK_LAST_STRESSABLE_TYPE,
ODK_LAST_STRESSABLE_TYPE = ODK_HASH,
// Put boolean after ODK_LAST_STRESSABLE_TYPE, so that we skip boolean type in
// SerializeFieldsStress because we unpack any nonzero to 'true'.
ODK_BOOL,