8160695: getHBScriptCode script code validation

Reviewed-by: bpb
This commit is contained in:
Phil Race 2016-07-01 14:29:36 -07:00
parent b6b66540e4
commit fd10d046e9

View File

@ -85,7 +85,7 @@ hb_script_t ICU_to_Harfbuzz_ScriptCode[] = {
int MAX_ICU_SCRIPTCODE = 45;
hb_script_t getHBScriptCode(int code) {
if (code > MAX_ICU_SCRIPTCODE) {
if ((code < 0) || (code > MAX_ICU_SCRIPTCODE)) {
return HB_SCRIPT_INVALID;
}
return ICU_to_Harfbuzz_ScriptCode[code];