cossacklabs / themis

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
https://www.cossacklabs.com/themis
Apache License 2.0
1.85k stars 143 forks source link

jsthemis: Add missing returns after errors #999

Closed G1gg1L3s closed 1 year ago

G1gg1L3s commented 1 year ago

There were two places in the code with missing return statements after errors. As a result, if something in key generation goes wrong, the wrapper will segfault while trying to allocate huge vectors for the keys.

It's interesting how these bugs remained unnoticed for such a long time (~4 years). This is because it's hard to make key pair generation fail and it works surprisingly well most of the time :)

This change will prevent some of the segfaults in the #996, but will not resolve the issue.

Checklist