On Mon, 23 Nov 2026 08:14:38 GMT, Matthias Baesken <[email protected]> wrote:

>> I'm not sure why, but I don't see a GHA build for your latest changes.
>> And alas, when I try it I get compilation errors
>> 
>> src/java.desktop/share/native/libsplashscreen/splashscreen_gif.c:109:10: 
>> error: comparison of integers of different signs: 'int' and 'unsigned long' 
>> [-Werror,-Wsign-compare]
>>   109 |     if (!SAFE_TO_ALLOC(gif->ImageCount, sizeof(SplashImage*))) {
>>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h:190:11: 
>> note: expanded from macro 'SAFE_TO_ALLOC'
>>   190 |      ((c) <= INT_MAX / (sz)))
>>       |        ~  ^  ~~~~~~~~~~~~~~
>> 1 error generated.
>> src/java.desktop/share/native/libsplashscreen/splashscreen_jpeg.c:160:10: 
>> error: comparison of integers of different signs: 'JDIMENSION' (aka 
>> 'unsigned int') and 'int' [-Werror,-Wsign-compare]
>>   160 |     if (!SAFE_TO_ALLOC(cinfo->output_width, 
>> cinfo->output_components)) {
>>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> src/java.desktop/share/native/libsplashscreen/splashscreen_impl.h:190:11: 
>> note: expanded from macro 'SAFE_TO_ALLOC'
>>   190 |      ((c) <= INT_MAX / (sz)))
>>       |        ~  ^  ~~~~~~~~~~~~~~
>> 
>> Did you not see such an error locally ?
>> 
>> So the comparisons are agaisnt the same type. I think in the macro after 
>> passing the > 0 test each value should be promoted to size_t, since that is 
>> what sizeof() will return and so should be at least as safe.
>> 
>> That fixes it for me on macOS
>> #define SAFE_TO_ALLOC(c, sz)                                               \
>>     (((c) > 0) && ((sz) > 0) &&                                            \
>>      ((size_t)(c) <= (size_t)INT_MAX / (size_t)(sz)))
>> 
>> Do you see any problems with that ?
>
>> I'm not sure why, but I don't see a GHA build for your latest changes.
> 
> @Sovtouch did you enable GHAs for your PRs/your OpenJDK fork?  I see no 
> checks besides the jcheck for this PR.

@MBaesken Thanks for pointing this out. I apparently disabled GitHub Actions in 
my fork by accident. I have been building and testing locally with GCC. I have 
now re-enabled GitHub Actions, but initially selected the wrong branch. I ran 
the checks on the correct branch (8397415).

-------------

PR Comment: https://git.openjdk.org/jdk/pull/33915#issuecomment-7095394459

Reply via email to