rootvector2 commented on PR #505: URL: https://github.com/apache/commons-bcel/pull/505#issuecomment-4753260767
No equivalent for u4. `DataInput` has no `readUnsignedInt`, so a u4 always lands in an `int` regardless and there is no one-line read-it-unsigned fix like there was for u2. Going through the `readInt()` sites, the fields with real unsigned u4 semantics are already covered: - `magic` in `ClassParser` is only compared against `JVM_CLASSFILE_MAGIC`, so sign does not matter. - `code_length` in `Code` goes through `Args.requireU4(..., 0, MAX_CODE_SIZE, ...)`, which rejects a high-bit-set (negative) value since min is 0. - `attribute_length` in `Attribute.readAttribute` flows into `Unknown`, gated by `length > 0` and the `MAX_LEN` cap, so a negative length reads nothing rather than over-allocating. The rest are genuinely signed s4 and have to stay `readInt()`: `ConstantInteger`'s value, and the switch default offsets / `low`/`high` / match keys / jump offsets in `Utility`, `CodeHTML`, `TABLESWITCH`, `LOOKUPSWITCH`, `Select`, `JSR_W`, `GOTO_W`. So nothing to change for u4. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
