Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: "the reference elements" --> "the referenced elements"

...

Some copy constructors and clone() methods perform a shallow copy of the original instance. For example, invocation of clone() on an array results in creation of an array instance whose elements have the same values as the original instance. This shallow copy is sufficient for arrays of primitive types but fails to protect against TOCTOU vulnerabilities when the elements are references to mutable objects, such as an array of cookies. In this case, a deep copy must be performed that also duplicates the reference referenced elements.

This compliant solution demonstrates correct use both of a shallow copy (for the array of int) and also of a deep copy (for the array of cookies).

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="87b03ca499ad193b-0364f674-419b4e30-acf9b00b-c1af29652829bb7fb9aa803a"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Item 39: Make defensive copies when needed

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a9a68bb49273790e-5659f591-44fb4216-a5e0a40f-6b202e1a5f5953cdee4a8860"><ac:plain-text-body><![CDATA[

[[Pugh 2009

AA. Bibliography#Pugh 09]]

Returning references to internal mutable state

]]></ac:plain-text-body></ac:structured-macro>

...