tls: tls_wrap causes debug assert in vector

When using a debug build (on Windows specifically) the error case for
tls_wrap causes an assert to fire because the index being passed is
outside the bounds of the vector.

The fix is to switch to iterators.

PR-URL: https://github.com/nodejs/node/pull/18830
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Kyle Farnung 2018-02-16 16:00:23 -08:00 committed by Kyle Farnung
parent 28f3ffba0f
commit de0ed84f04

View File

@ -491,8 +491,8 @@ bool TLSWrap::ClearIn() {
// This can be skipped in the error case because no further writes
// would succeed anyway.
pending_cleartext_input_.insert(pending_cleartext_input_.end(),
&buffers[i],
&buffers[buffers.size()]);
buffers.begin() + i,
buffers.end());
}
return false;