Skip to content

Commit

Permalink
8296854: NULL check of CTFontCopyAvailableTables return value is requ…
Browse files Browse the repository at this point in the history
…ired

Reviewed-by: kcr
  • Loading branch information
prrace committed Dec 7, 2022
1 parent 6f36e70 commit f96b350
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Expand Up @@ -64,6 +64,9 @@ public void decode(String fontName) throws IOException {
throw new IOException("Unsupported Dfont");
}
int[] tags = DFontDecoder.getCTFontTags(fontRef);
if (tags == null) {
throw new IOException("Could not get tables for Dfont");
}
short numTables = (short)tags.length;
int size = TTCHEADERSIZE + (DIRECTORYENTRYSIZE * numTables);
byte[][] tableData = new byte[numTables][];
Expand Down
3 changes: 3 additions & 0 deletions modules/javafx.graphics/src/main/native-font/dfontdecoder.c
Expand Up @@ -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) {
Expand Down

0 comments on commit f96b350

Please sign in to comment.