Skip to content

Commit

Permalink
Check for null pointer passed to memcpy (#1296)
Browse files Browse the repository at this point in the history
This only happens when the size parameter is 0, in which memcpy will
not fail, but SonarCloud flags this as a problem:

https://sonarcloud.io/project/issues?resolved=false&sinceLeakPeriod=true&types=BUG&id=AcademySoftwareFoundation_openexr&open=AYPeU0_LmU8C9mUeoOgr

Signed-off-by: Cary Phillips <[email protected]>

Signed-off-by: Cary Phillips <[email protected]>
  • Loading branch information
cary-ilm committed Mar 5, 2023
1 parent 16789e4 commit 7650bbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/OpenEXRCore/opaque.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ exr_attr_opaquedata_create (
exr_result_t rv = exr_attr_opaquedata_init (ctxt, u, b);
if (rv == EXR_ERR_SUCCESS)
{
if (d) memcpy ((void*) u->packed_data, d, b);
if (d && u->packed_data) memcpy ((void*) u->packed_data, d, b);
}

return rv;
Expand Down

0 comments on commit 7650bbb

Please sign in to comment.