braintree_java icon indicating copy to clipboard operation
braintree_java copied to clipboard

Crypto#secureCompare : use the primitive type as the return value could not be null

Open benbenw opened this issue 5 years ago • 5 comments

Summary

Fix Crypto#secureCompare signature to use the primitive type as the return value could not be null

Checklist

  • [X] Added changelog entry
  • [X] Ran unit tests (mvn verify -DskipITs)

benbenw avatar Nov 27 '20 13:11 benbenw

Hi @benbenw,

Thanks for opening this PR. Since this change modifies the return type of a publicly visible method, we won't be able to merge this until we release the next major version of the project.

billwerges avatar Nov 30 '20 18:11 billwerges

no pb but due to java type boxing it should be backward compatible to the callers

benbenw avatar Nov 30 '20 20:11 benbenw

@benbenw sorry for the long delay on this. I'm just curious about what scenarios the return type could be null here. I see 2 places we return:

An early return of false:

        return false;

And a final return where it asserts on the value of result:

        return result == 0;

In what instances could this ever return null?

crookedneighbor avatar Aug 11 '22 14:08 crookedneighbor

for internal tracking, ticket 666

hollabaq86 avatar Sep 28 '22 16:09 hollabaq86

@benbenw sorry for the long delay on this. I'm just curious about what scenarios the return type could be null here. I see 2 places we return:

An early return of false:

        return false;

And a final return where it asserts on the value of result:

        return result == 0;

In what instances could this ever return null?

It could not return null that what this issue is about ! As stated in the description :
Fix Crypto#secureCompare signature to use the primitive type as the return value could not be null

benbenw avatar Oct 10 '22 13:10 benbenw