Buffer classes defined in the {{Wiki Markup java.nio}} package, such as {{IntBuffer}}, {{CharBuffer}}, and {{ByteBuffer}}, define a variety of {{wrap()}} methods that wrap an array of the corresponding primitive data type into a buffer and return the buffer as a {{Buffer}} object. Although these methods create a new {{Buffer}} object, the new {{Buffer}} is backed by the given input array. According to the Java API for these methods \ [[API 2006|AA. References#API 06]\],
The new buffer will be backed by the given character array; that is, modifications to the buffer will cause the array to be modified and vice versa.
...
Sound automated detection of this vulnerability is not feasible. Heuristic approaches may be useful.
Bibliography
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="ed17e0cf-3675-4d2f-9b36-157ddfbfa542"><ac:plain-text-body><![CDATA[ | [ [API 2006AA. References#API 06] ] | class |
[CDATA[ [[Hitchens 2002AA. References#Hitchens 02]] | 2.3 Duplicating Buffers ]]></ac:plain-text-body></ac:structured-macro> |
...
12. Input Output (FIO) FIO06-J. Do not create multiple buffered wrappers on a single InputStream