VWR-25608 error on shutdown due to buffer overrun in LLVFS::audit
Review Request #278 - Created April 26, 2011 and submitted
Brad Kittenbrink | Reviewers | ||
http://bitbucket.org/lindenlab/viewer-development | viewer | ||
VWR-25608 | |||
None | viewer-development |
Fix for a minor buffer overrun on shutdown in LLVFS::audit.
I tested using the Microsoft Debug Heap and confirmed that this allows the Debug Heap to shut down without errors.
hg rm llconfusingcode.cpp is better, but llmax() works here.
Posted (April 27, 2011, 3:30 a.m.)
-
indra/llvfs/llvfs.cpp (Diff revision 1) -
When index_size == 0, wouldn't it be more appropriate to skip the steps that require taking the address of element 0? They'd be nil operations in that case, anyway, wouldn't they?
-
indra/llvfs/llvfs.cpp (Diff revision 1) -
e.g. here we could extend the condition to if (!buffer.empty() && (fread(&buffer[0], 1, index_size, mIndexFP) != index_size))
-
indra/llvfs/llvfs.cpp (Diff revision 1) -
If index_size == 0, we don't even enter this loop ...
-
indra/llvfs/llvfs.cpp (Diff revision 1) -
... so taking the address here shouldn't be problematic.
Finally, if we are only ever accessing the underlying memory directly (as seems to be the case here), why use a std::vector as buffer instead of an array?
Other reviews