...
This compliant solution declares the native method private
. Furthermore, the doOperation()
wrapper method performs routine permission checking to determine whether the succeeding operations are permitted to continue. This is followed by the creation of a defensive copy of the mutable input array data
as well as by range checking of the parameters. The nativeOperation()
method is thus consequently called with safe inputs. Note that the validation checks must produce outputs that conform to the input requirements of the native implementations/libraries.
...
Failure to define wrappers around native methods can allow unprivileged callers to invoke them and thus consequently exploit inherent vulnerabilities such as those resulting from invalid inputs.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="526380e94871ac4d-7995125b-4fc74523-a6e7999b-1cb2c0197a96aa7e3edfd3ba"><ac:plain-text-body><![CDATA[ | [[MITRE 2009 | AA. Bibliography#MITRE 09]] | [CWE ID 111 | http://cwe.mitre.org/data/definitions/111.html] "Direct Use of Unsafe JNI" | ]]></ac:plain-text-body></ac:structured-macro> |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="3ab407c6698da57b-90b7f2a2-4b274355-a5a1a9ec-1566fd285ddc7005ba9dd7c0"><ac:plain-text-body><![CDATA[ | [[Fairbanks 2007 | AA. Bibliography#Fairbanks 07]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="85355dd4b87d3e00-b782cb01-4cd04f28-9140b43a-050ed34d41887511c76f9185"><ac:plain-text-body><![CDATA[ | [[JNI 2006 | AA. Bibliography#JNI 06]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7db58625c3cb72d1-fdb4d78e-4df448e1-b097947d-f57f2d0970802024fca33079"><ac:plain-text-body><![CDATA[ | [[Liang 1997 | AA. Bibliography#Liang 97]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a0a2fe9fcd9ce98f-bdf7c292-4a9b416e-bfcba0c4-9e01f07a2871860208eee8f6"><ac:plain-text-body><![CDATA[ | [[Macgregor 1998 | AA. Bibliography#Macgregor 98]] | Section 2.2.3, Interfaces and Architectures | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="798519b1537cf9b7-c6ab66e8-40b945f6-83e984ff-03a0e858e81c0fb7ab33fa55"><ac:plain-text-body><![CDATA[ | [[SCG 2007 | AA. Bibliography#SCG 07]] | Guideline 3-3 Define wrappers around native methods | ]]></ac:plain-text-body></ac:structured-macro> |
...