Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8296854

NULL check of CTFontCopyAvailableTables return value is required

XMLWordPrintable

    • b11
    • x86_64
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      macOS Monterey
      openjdk version "17.0.4.1" 2022-08-12
      OpenJDK Runtime Environment (build 17.0.4.1+1)
      OpenJDK 64-Bit Server VM (build 17.0.4.1+1, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      The same code that caused the crash in JDK-8287609 was
      Found in dfontdecoder.c

      jfx/modules/javafx.graphics/src/main/native-font/dfontdecoder.c
      ----
      JNIEXPORT jintArray JNICALL Java_com_sun_javafx_font_DFontDecoder_getCTFontTags
      (JNIEnv *env, jclass clazz, jlong fontPtr)
      {
          CTFontRef fontRef = (CTFontRef)fontPtr;
          CTFontTableOptions options = kCTFontTableOptionNoOptions;
          CFArrayRef tags = CTFontCopyAvailableTables(fontRef, options);
          CFIndex count = CFArrayGetCount(tags);
      ----

      The patch is in the Workaround section. I am OCA signed.


      CUSTOMER SUBMITTED WORKAROUND :
      diff --git a/modules/javafx.graphics/src/main/native-font/dfontdecoder.c b/modules/javafx.graphics/src/main/native-font/dfontdecoder.c
      index 2ce8e875f3..2fdbc0a428 100644
      --- a/modules/javafx.graphics/src/main/native-font/dfontdecoder.c
      +++ b/modules/javafx.graphics/src/main/native-font/dfontdecoder.c
      @@ -117,6 +117,9 @@ JNIEXPORT jintArray JNICALL Java_com_sun_javafx_font_DFontDecoder_getCTFontTags
           CTFontRef fontRef = (CTFontRef)fontPtr;
           CTFontTableOptions options = kCTFontTableOptionNoOptions;
           CFArrayRef tags = CTFontCopyAvailableTables(fontRef, options);
      + if (tags == NULL) {
      + return NULL;
      + }
           CFIndex count = CFArrayGetCount(tags);
           jintArray intArrObj = (*env)->NewIntArray(env, count);
           if (intArrObj == NULL) {

      FREQUENCY : always


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: