On Fri, 6 Nov 2026 17:13:03 GMT, Alexander Zvegintsev <[email protected]>
wrote:
>> Phil Race has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> 8396849
>
> src/java.desktop/unix/native/common/awt/fontpath.c line 986:
>
>> 984: (*env)->ReleaseStringUTFChars(env, fcNameStr, (const
>> char*)fcName);
>> 985: (*env)->DeleteLocalRef(env, fcNameStr);
>> 986: if (pattern == NULL) {
>
> (*FcPatternGetInteger)(pattern, FC_WEIGHT, 0, &expectedWeight);
> (*FcPatternGetInteger)(pattern, FC_SLANT, 0, &expectedSlant);
>
>
> Shouldn't these calls come after the NULL check for `pattern`?
>
> Shouldn't we also check the return values of all 4 `FcPatternGetInteger`
> calls?
>
> If a call fails, we could use an uninitialized value of `expectedWeight`,
> `expectedSlant`, `weight`, or `slant`.
I moved the calls down to right before the loop.
I don't actually see how the calls could fail - these are standard properties
and fontconfig should always return a value.
But I initialized sensible defaults so that if the call fails, we use those
defaults.
I also updated the test to compare each style of a font against the same style
of the other fonts.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/33761#discussion_r4496299614