8160695: getHBScriptCode script code validation
authorprr
Fri, 01 Jul 2016 14:29:36 -0700
changeset 39549 26cd79781f7a
parent 39548 ad363c42f790
child 39550 8d587cab45d2
8160695: getHBScriptCode script code validation Reviewed-by: bpb
jdk/src/java.desktop/share/native/libfontmanager/scriptMapping.c
--- a/jdk/src/java.desktop/share/native/libfontmanager/scriptMapping.c	Fri Jul 01 14:27:13 2016 -0700
+++ b/jdk/src/java.desktop/share/native/libfontmanager/scriptMapping.c	Fri Jul 01 14:29:36 2016 -0700
@@ -85,7 +85,7 @@
 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];