Skip to content

Commit 5dd155a

Browse files
committed
crypto: ensure that read head is always non-empty
1 parent 4536b27 commit 5dd155a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/node_crypto_bio.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ size_t NodeBIO::Read(char* out, size_t size) {
203203
read_head_->write_pos_ = 0;
204204

205205
// But not get beyond write_head_
206-
if (bytes_read != expected)
206+
if (length_ != bytes_read) {
207+
assert(read_head_ != write_head_);
207208
read_head_ = read_head_->next_;
209+
}
208210
}
209211
}
210212
assert(expected == bytes_read);

0 commit comments

Comments
 (0)