src: fix crash when writing odd-length hex string via Writev · nodejs/node@37085f8 · GitHub
Skip to content

Commit 37085f8

Browse files
RajeshKumar11aduh95
authored andcommitted
src: fix crash when writing odd-length hex string via Writev
StringBytes::StorageSize had a CHECK that fatal-asserted when a hex-encoded string with an odd number of characters was written through Writev (e.g. via HTTP requests which are automatically corked). Writing the same string via a single Write did not crash because StringBytes::Write delegates to HexDecode, which silently drops the trailing incomplete nibble. Remove the CHECK and let integer division handle odd lengths, which is consistent with StringBytes::Size and HexDecode. Fixes: #45150 Signed-off-by: RajeshKumar11 <kakumanurajeshkumar@gmail.com> PR-URL: #63658 Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
1 parent bf86741 commit 37085f8

2 files changed

Lines changed: 91 additions & 1 deletion

File tree

src/string_bytes.cc

Lines changed: 0 additions & 1 deletion
Lines changed: 91 additions & 0 deletions

0 commit comments

Comments
 (0)