Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/WebKit/Source/wtf/dtoa/utils.h

Issue 1677363002: Change assert to release assert for WTF::double_conversion::Vector to prevent OOB memory access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 // Returns the length of the vector. 157 // Returns the length of the vector.
158 int length() const { return length_; } 158 int length() const { return length_; }
159 159
160 // Returns whether or not the vector is empty. 160 // Returns whether or not the vector is empty.
161 bool is_empty() const { return length_ == 0; } 161 bool is_empty() const { return length_ == 0; }
162 162
163 // Returns the pointer to the start of the data in the vector. 163 // Returns the pointer to the start of the data in the vector.
164 T* start() const { return start_; } 164 T* start() const { return start_; }
165 165
166 // Access individual vector elements - checks bounds in debug mode. 166 // Access individual vector elements.
167 T& operator[](int index) const { 167 T& operator[](int index) const {
168 ASSERT(0 <= index && index < length_); 168 RELEASE_ASSERT(0 <= index && index < length_);
169 return start_[index]; 169 return start_[index];
170 } 170 }
171 171
172 T& first() { return start_[0]; } 172 T& first() { return start_[0]; }
173 173
174 T& last() { return start_[length_ - 1]; } 174 T& last() { return start_[length_ - 1]; }
175 175
176 private: 176 private:
177 T* start_; 177 T* start_;
178 int length_; 178 int length_;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 template <class Dest, class Source> 300 template <class Dest, class Source>
301 inline Dest BitCast(Source* source) { 301 inline Dest BitCast(Source* source) {
302 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); 302 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source));
303 } 303 }
304 304
305 } // namespace double_conversion 305 } // namespace double_conversion
306 306
307 } // namespace WTF 307 } // namespace WTF
308 308
309 #endif // DOUBLE_CONVERSION_UTILS_H_ 309 #endif // DOUBLE_CONVERSION_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698