Merge "Adjust data types to prevent load of invalid value" into sc-dev am: 9b9f051c92 am: 8ed5575e34

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14381853

Change-Id: If5a0a8f46d213f30b867d5e705852d62b1161fa1
This commit is contained in:
TreeHugger Robot 2021-04-30 22:55:10 +00:00 committed by Automerger Merge Worker
commit 8e4beaf191
1 changed files with 5 additions and 5 deletions

View File

@ -1694,8 +1694,7 @@ static TRANSPORTDEC_ERROR extElementConfig(CSUsacExtElementConfig *extElement,
const AUDIO_OBJECT_TYPE aot) { const AUDIO_OBJECT_TYPE aot) {
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK; TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
USAC_EXT_ELEMENT_TYPE usacExtElementType = UINT usacExtElementType = escapedValue(hBs, 4, 8, 16);
(USAC_EXT_ELEMENT_TYPE)escapedValue(hBs, 4, 8, 16);
/* recurve extension elements which are invalid for USAC */ /* recurve extension elements which are invalid for USAC */
if (aot == AOT_USAC) { if (aot == AOT_USAC) {
@ -1712,7 +1711,6 @@ static TRANSPORTDEC_ERROR extElementConfig(CSUsacExtElementConfig *extElement,
} }
} }
extElement->usacExtElementType = usacExtElementType;
int usacExtElementConfigLength = escapedValue(hBs, 4, 8, 16); int usacExtElementConfigLength = escapedValue(hBs, 4, 8, 16);
extElement->usacExtElementConfigLength = (USHORT)usacExtElementConfigLength; extElement->usacExtElementConfigLength = (USHORT)usacExtElementConfigLength;
INT bsAnchor; INT bsAnchor;
@ -1746,8 +1744,10 @@ static TRANSPORTDEC_ERROR extElementConfig(CSUsacExtElementConfig *extElement,
} }
} break; } break;
default: default:
usacExtElementType = ID_EXT_ELE_UNKNOWN;
break; break;
} }
extElement->usacExtElementType = (USAC_EXT_ELEMENT_TYPE)usacExtElementType;
/* Adjust bit stream position. This is required because of byte alignment and /* Adjust bit stream position. This is required because of byte alignment and
* unhandled extensions. */ * unhandled extensions. */
@ -1776,7 +1776,7 @@ static TRANSPORTDEC_ERROR configExtension(CSUsacConfig *usc,
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK; TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
int numConfigExtensions; int numConfigExtensions;
CONFIG_EXT_ID usacConfigExtType; UINT usacConfigExtType;
int usacConfigExtLength; int usacConfigExtLength;
int loudnessInfoSetIndex = int loudnessInfoSetIndex =
-1; /* index of loudnessInfoSet config extension. -1 if not contained. */ -1; /* index of loudnessInfoSet config extension. -1 if not contained. */
@ -1787,7 +1787,7 @@ static TRANSPORTDEC_ERROR configExtension(CSUsacConfig *usc,
for (int confExtIdx = 0; confExtIdx < numConfigExtensions; confExtIdx++) { for (int confExtIdx = 0; confExtIdx < numConfigExtensions; confExtIdx++) {
INT nbits; INT nbits;
int loudnessInfoSetConfigExtensionPosition = FDKgetValidBits(hBs); int loudnessInfoSetConfigExtensionPosition = FDKgetValidBits(hBs);
usacConfigExtType = (CONFIG_EXT_ID)escapedValue(hBs, 4, 8, 16); usacConfigExtType = escapedValue(hBs, 4, 8, 16);
usacConfigExtLength = (int)escapedValue(hBs, 4, 8, 16); usacConfigExtLength = (int)escapedValue(hBs, 4, 8, 16);
/* Start bit position of config extension */ /* Start bit position of config extension */