y-scope / clp-ffi-java

Apache License 2.0
10 stars 3 forks source link

Handle params which could be null and shouldn't be null. #36

Closed kirkrodrigues closed 1 year ago

kirkrodrigues commented 1 year ago

Description

Various null inputs were not handled correctly leading to the possibility of segfaults since these nulls would be passed to the native code. This PR targets those specific nulls either by handling them correctly if they are valid inputs or disallowing them if they are invalid inputs.

In addition, for various native methods, this PR passes the length of arrays as an argument to avoid calling into the JVM to get the lengths (this should improve performance slightly).

Validation performed

Added new unit tests and validated all tests pass.