[OpenJDK 2D-Dev] RFR: 8160695 : getHBScriptCode script code validation

Brian Burkhalter brian.burkhalter at oracle.com
Thu Jun 30 23:38:16 UTC 2016


+1

Brian

On Jun 30, 2016, at 4:09 PM, Phil Race <philip.race at oracle.com> wrote:

> https://bugs.openjdk.java.net/browse/JDK-8160695
> 
> A simple fix to ensure we check an array index is positive.
> In fact the value is always positive anyway, so this is just for "extra" safety.
> 
> diff --git a/src/java.desktop/share/native/libfontmanager/scriptMapping.c b/src/java.desktop/share/native/libfontmanager/scriptMapping.c
> --- a/src/java.desktop/share/native/libfontmanager/scriptMapping.c
> +++ b/src/java.desktop/share/native/libfontmanager/scriptMapping.c
> @@ -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];
> 
> 
> -phil.
> 




More information about the 2d-dev mailing list