Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: do not move half-filled write head
Browse files Browse the repository at this point in the history
Might cause write head running over read head, when there were no
allocation and `Commit()` was called. Source of at least one test
failure on windows (`simple/test-https-drain.js`).
  • Loading branch information
indutny committed Jun 26, 2013
1 parent adf9b67 commit 4ae96c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node_crypto_bio.cc
Expand Up @@ -315,6 +315,7 @@ void NodeBIO::Write(const char* data, size_t size) {

// Go to next buffer if there still are some bytes to write
if (left != 0) {
assert(write_head_->write_pos_ == kBufferLength);
TryAllocateForWrite();
write_head_ = write_head_->next_;
}
Expand Down Expand Up @@ -342,7 +343,8 @@ void NodeBIO::Commit(size_t size) {
// Allocate new buffer if write head is full,
// and there're no other place to go
TryAllocateForWrite();
write_head_ = write_head_->next_;
if (write_head_->write_pos_ == kBufferLength)
write_head_ = write_head_->next_;
}


Expand Down

0 comments on commit 4ae96c8

Please sign in to comment.