Commit 990feaf
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>1 parent 17efd93 commit 990feaf
File tree
3 files changed
+26
-9
lines changed- src
- test/parallel
3 files changed
+26
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4634 | 4634 | | |
4635 | 4635 | | |
4636 | 4636 | | |
4637 | | - | |
4638 | | - | |
4639 | | - | |
4640 | | - | |
| 4637 | + | |
| 4638 | + | |
| 4639 | + | |
| 4640 | + | |
| 4641 | + | |
| 4642 | + | |
| 4643 | + | |
| 4644 | + | |
4641 | 4645 | | |
4642 | 4646 | | |
4643 | 4647 | | |
4644 | 4648 | | |
4645 | | - | |
4646 | | - | |
| 4649 | + | |
| 4650 | + | |
4647 | 4651 | | |
4648 | 4652 | | |
4649 | 4653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
598 | | - | |
| 598 | + | |
| 599 | + | |
599 | 600 | | |
600 | 601 | | |
601 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
602 | 607 | | |
603 | 608 | | |
| 609 | + | |
| 610 | + | |
604 | 611 | | |
605 | 612 | | |
606 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
38 | 44 | | |
39 | 45 | | |
40 | 46 | | |
0 commit comments