diff options
author | gitHubTracey <macmommytracey@gmail.com> | 2017-10-06 21:24:47 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-10-22 21:11:24 +0300 |
commit | 838eca26566134af60116ebc9694e860d7310f0d (patch) | |
tree | cf6f081a68adfdbe9a6ea91ad20bea6fffa4a661 /src/string_search.h | |
parent | 7a171fd88a2e7ce06121ce016ea0f15d1b5a158e (diff) |
src: operator[] checks bounds in debug mode
PR-URL: https://github.com/nodejs/node/pull/16002
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/string_search.h')
-rw-r--r-- | src/string_search.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/string_search.h b/src/string_search.h index 73e90f5873f..6e76a5b8f41 100644 --- a/src/string_search.h +++ b/src/string_search.h @@ -44,7 +44,9 @@ class Vector { // Access individual vector elements - checks bounds in debug mode. T& operator[](size_t index) const { +#ifdef DEBUG CHECK(index < length_); +#endif return start_[is_forward_ ? index : (length_ - index - 1)]; } |