Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 15

...

Code Block
bgColor#ccccff
public static long getInteger(DataInputStream is) throws IOException {
  return is.readInt() & 0xFFFFFFFFL;	
}

Risk Assessment

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

References

Wiki Markup
\[[API 06|AA. Java References#API 06]\] Class DataInputStream: method {{readInt}}
\[[Harold 97|AA. Java References#Harold 97]\] Chapter 2: Primitive Data Types, Cross Platform Issues, Unsigned Integers
\[[Hitchens 02|AA. Java References#Hitchens 02]\] 2.4.5 Accessing Unsigned Data

...

INT00-J. Provide methods to read and write Little-Endian data      06. Integers (INT)      INT02INT30-J. Do not assume a positive remainder when using the remainder operatorRange check before casting integers to narrower types