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

Unified Diff: media/formats/webm/webm_parser.cc

Issue 251583003: Ensure DiscardPadding is parsed as a signed integer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove bad rebase. Created 6 years, 8 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 | « media/formats/webm/webm_cluster_parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/webm/webm_parser.cc
diff --git a/media/formats/webm/webm_parser.cc b/media/formats/webm/webm_parser.cc
index 2f2a1d2efa5b5305361ae423a56aa65af70665f4..1baf12b4a59d4b0df268c6292225483d6f4f0c9b 100644
--- a/media/formats/webm/webm_parser.cc
+++ b/media/formats/webm/webm_parser.cc
@@ -14,6 +14,7 @@
#include <iomanip>
#include "base/logging.h"
+#include "base/numerics/safe_conversions.h"
#include "media/formats/webm/webm_constants.h"
namespace media {
@@ -118,7 +119,7 @@ static const ElementIdInfo kBlockGroupIds[] = {
{UINT, kWebMIdReferencePriority},
{BINARY, kWebMIdReferenceBlock},
{BINARY, kWebMIdCodecState},
- {UINT, kWebMIdDiscardPadding},
+ {BINARY, kWebMIdDiscardPadding},
{LIST, kWebMIdSlices},
};
@@ -548,10 +549,15 @@ static int ParseUInt(const uint8* buf, int size, int id,
return -1;
// Read in the big-endian integer.
- int64 value = 0;
+ uint64 value = 0;
for (int i = 0; i < size; ++i)
value = (value << 8) | buf[i];
+ // We use int64 in place of uint64 everywhere for convenience. See this bug
+ // for more details: http://crbug.com/366750#c3
+ if (!base::IsValueInRangeForNumericType<int64>(value))
+ return -1;
+
if (!client->OnUInt(id, value))
return -1;
« no previous file with comments | « media/formats/webm/webm_cluster_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698