Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uint8 salt_[LINK_SALT_LENGTH];
- VisitedLinkMaster::TableBuilder::TableBuilder(
- VisitedLinkMaster* master,
- const uint8 salt[LINK_SALT_LENGTH])
- : master_(master),
- success_(true) {
- fingerprints_.reserve(4096);
- memcpy(salt_, salt, sizeof(salt));
- }
- The 'salt' object is simply a pointer. Value LINK_SALT_LENGTH in the square brackets indicates to the programmer that he is working with an array of LINK_SALT_LENGTH items.
- But it is not an array of items which is passed into the function - it is only the pointer.
- So, the sizeof(salt) expression will return value 4 or 8 (the size of the pointer in a 32-bit/64-bit system).
- This suspicious code was found in Chromium project by PVS-Studio static code analyzer.
- Warning message is:
- V511 The sizeof() operator returns size of the pointer, and not of the array, in 'sizeof (salt)' expression. browser visitedlink_master.cc 968
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment