Commit c16c314
crypto: fix crash when calling digest after piping
When piping data into an SHA3 hash, EVP_DigestFinal_ex is called in
hash._flush, bypassing safeguards in the JavaScript layer. Calling
hash.digest causes EVP_DigestFinal_ex to be called again, resulting
in a segmentation fault in the SHA3 implementation of OpenSSL.
A relatively easy solution is to cache the result of calling
EVP_DigestFinal_ex until the Hash object is garbage collected.
PR-URL: #28251
Fixes: #28245
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Backport-PR-URL: #37009
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>1 parent d6f3694 commit c16c314
2 files changed
+18
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3419 | 3419 | | |
3420 | 3420 | | |
3421 | 3421 | | |
3422 | | - | |
3423 | | - | |
3424 | | - | |
3425 | | - | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
3426 | 3430 | | |
3427 | 3431 | | |
3428 | 3432 | | |
3429 | 3433 | | |
3430 | | - | |
3431 | | - | |
| 3434 | + | |
| 3435 | + | |
3432 | 3436 | | |
3433 | 3437 | | |
3434 | 3438 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
479 | 480 | | |
480 | 481 | | |
481 | 482 | | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
482 | 487 | | |
483 | 488 | | |
| 489 | + | |
| 490 | + | |
484 | 491 | | |
485 | 492 | | |
486 | 493 | | |
| |||
0 commit comments