On Mon, 5 Dec 2022 18:22:15 GMT, Phil Race <[email protected]> wrote:

>> I changed GCC toolchain from GCC6 to GCC8 on SLES12SP5 Linux s390x.
>> I could see following errors:
>> 
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c: In 
>> function 'allocateRasterArray':
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:2944:73: 
>> error: 'roff[3]' may be used uninitialized in this function 
>> [-Werror=maybe-uninitialized]
>>                              (((*inP&rasterP->sppsm.maskArray[c]) >> roff[c])
>>                                                                      ~~~~^~~
>> 
>> 
>> According to error messages,
>> roff and loff may not be initialized.
>
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c: In 
>> function 'allocateRasterArray':
>> src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c:2944:73: 
>> error: 'roff[3]' may be used uninitialized in this function 
>> [-Werror=maybe-uninitialized]
>>                              (((*inP&rasterP->sppsm.maskArray[c]) >> roff[c])
> 
> That's weird. allocateRasterArray is at lines 2360-2575 .. so why are you 
> seeing it at line 2944 ????

Thanks @prrace .
>That's weird. allocateRasterArray is at lines 2360-2575 .. so why are you 
>seeing it at line 2944 ????

Ummm, I could not determine the reason...

I assume AddressSanitizer detected memory errors because of following 2 codes:
https://github.com/openjdk/jdk/blob/1e468320dc6e495343dbdf392cbcbda79672c7ad/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c#L2937
https://github.com/openjdk/jdk/blob/1e468320dc6e495343dbdf392cbcbda79672c7ad/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c#L3118

So I'd like to put `memset()` on these parts.

But I checked `if` and `else` blocks on above part.
These are exactly the same.
https://github.com/openjdk/jdk/blob/1e468320dc6e495343dbdf392cbcbda79672c7ad/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c#L2937-L2965
https://github.com/openjdk/jdk/blob/1e468320dc6e495343dbdf392cbcbda79672c7ad/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c#L3118-L3153

I tried to modify from `if .. else` block to flat.
AddressSanitizer did not detect memory error.

Could you give me any advice ?

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

PR: https://git.openjdk.org/jdk/pull/11475

Reply via email to