Fixing two std::vector::operator[] out of range accesses.
This can be reproduced in debug builds by defining _GLIBCXX_DEBUG:
CXXFLAGS=-m32 CFLAGS=-m32 CPPFLAGS="-m32 -g -O0 -D_GLIBCXX_DEBUG" ./configure
While modifying the files I also fixed a couple of lint warnings:
- Replacing C-style cast with reinterpret_cast
- Position of curly braces
Thanks,
-Ivan
On 2013/05/21 02:40:33, Mark Mentovai wrote:
> How does .resize() work but the constructor not work?
The constructor calls .reserve() which only allocates (increases capacity) and
the initial size is still 0. A little confusing considering that std::vector
has a similar constructor which initializes (inserts actual elements).
On 2013/05/21 12:51:03, Mark Mentovai wrote:
> LGTM. Good catch, then.
Thanks. For performance reasons I decided to also keep the original size hint
passed-in to the constructor (in order to avoid a possible second allocation
when calling .resize()). I also added comment explaining why we need to call
.resize().
Issue 597002: Fixing two std::vector::operator[] out of range accesses
(Closed)
Created 11 years, 3 months ago by Ivan Penkov
Modified 11 years, 3 months ago
Reviewers: Mark Mentovai, Jess, Ted Mielczarek, digit
Base URL: http://google-breakpad.googlecode.com/svn/trunk/
Comments: 0