On Tue, 14 Feb 2023 16:59:03 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:

>> src/java.base/share/native/libjimage/imageFile.hpp line 218:
>> 
>>> 216: // Notes:
>>> 217: //  - Even though ATTRIBUTE_END is used to mark the end of the 
>>> attribute stream,
>>> 218: //      streams will contain non-zero byte values to represent lesser 
>>> significant bits.
>> 
>> This change is not correct. Maybe it is badly worded but the point is that 
>> **zeroes can** occur in the stream so testing for zero is insufficient.
>
> @JimLaskey OK. Perhaps we can be clearer what is meant here exactly. I was 
> having a hard time deciphering this. It does say `stream will contain zero 
> byte values to represent lesser significant bits`. **What** are "byte values 
> to represent lesser significant bits"?

To me it sounded like it wanted to say: Since the `ATTRIBUTE_END` isn't a full 
byte (only 5 bits in a byte), it might be represented as a non-zero value. For 
example a byte containing `0x07` would equally be `ATTRIBUTE_END` as would a 
zero byte or a `0x01` byte. `ATTRIBUTE_END` is a `kind` which is encoded with 
the *most* significant `5` bits. Yet, `ATTRIBUTE_END` isn't a full byte. The 
least significant `3` bits in the byte represent the `length - 1` - of bytes - 
in the attribute stream for offset values. That, to me, also would suggest that 
comparing it to a zero byte value is not sufficient to detect `ATTRIBUTE_END`.

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

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

Reply via email to