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

Unified Diff: chrome/browser/policy/preg_parser_win.cc

Issue 23704008: Properly handle zero-sized fields in the PReg parser. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/policy/preg_parser_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/preg_parser_win.cc
diff --git a/chrome/browser/policy/preg_parser_win.cc b/chrome/browser/policy/preg_parser_win.cc
index 0351dac5dac51d4c5feba155fad326efd5cd2fd4..cd855d3dda0496551d776e0f22b48038ead4b45d 100644
--- a/chrome/browser/policy/preg_parser_win.cc
+++ b/chrome/browser/policy/preg_parser_win.cc
@@ -64,12 +64,13 @@ int NextChar(const uint8** cursor, const uint8* end) {
// Reads a fixed-size field from a PReg file.
bool ReadFieldBinary(const uint8** cursor,
const uint8* end,
- int size,
+ uint32 size,
uint8* data) {
- if (!size)
- return false;
+ if (size == 0)
+ return true;
+
const uint8* field_end = *cursor + size;
- if (field_end > end)
+ if (field_end <= *cursor || field_end > end)
Joao da Silva 2013/09/13 14:18:07 if this accepted "field_end == *cursor" then it wo
Mattias Nissler (ping if slow) 2013/09/13 14:40:24 The size == 0 check is here to handle the case of
return false;
std::copy(*cursor, field_end, data);
*cursor = field_end;
« no previous file with comments | « no previous file | chrome/browser/policy/preg_parser_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698