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

Side by Side Diff: third_party/WebKit/Source/modules/crypto/NormalizeAlgorithm.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and applied senorblanco+haraken feedbac Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // Defined by the WebCrypto spec as: 321 // Defined by the WebCrypto spec as:
322 // 322 //
323 // typedef Uint8Array BigInteger; 323 // typedef Uint8Array BigInteger;
324 bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<DOMUi nt8Array>& array, const ErrorContext& context, AlgorithmError* error) 324 bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<DOMUi nt8Array>& array, const ErrorContext& context, AlgorithmError* error)
325 { 325 {
326 if (!getUint8Array(raw, propertyName, array, context, error)) 326 if (!getUint8Array(raw, propertyName, array, context, error))
327 return false; 327 return false;
328 328
329 if (!array->byteLength()) { 329 if (!array->byteLength()) {
330 // Empty BigIntegers represent 0 according to the spec 330 // Empty BigIntegers represent 0 according to the spec
331 array = DOMUint8Array::create(1); 331 array = DOMUint8Array::deprecatedCreateOrCrash(0, 0);
haraken 2015/10/29 18:58:37 Shouldn't this be deprecatedCreateOrCrash(nullptr,
Justin Novosad 2015/11/05 00:17:52 Done.
332 } 332 }
333 333
334 return true; 334 return true;
335 } 335 }
336 336
337 // Gets an integer according to WebIDL's [EnforceRange]. 337 // Gets an integer according to WebIDL's [EnforceRange].
338 bool getOptionalInteger(const Dictionary& raw, const char* propertyName, bool& h asProperty, double& value, double minValue, double maxValue, const ErrorContext& context, AlgorithmError* error) 338 bool getOptionalInteger(const Dictionary& raw, const char* propertyName, bool& h asProperty, double& value, double minValue, double maxValue, const ErrorContext& context, AlgorithmError* error)
339 { 339 {
340 double number; 340 double number;
341 bool ok = DictionaryHelper::get(raw, propertyName, number, hasProperty); 341 bool ok = DictionaryHelper::get(raw, propertyName, number, hasProperty);
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 } 978 }
979 979
980 } // namespace 980 } // namespace
981 981
982 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error) 982 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, WebCryptoOperation op, W ebCryptoAlgorithm& algorithm, AlgorithmError* error)
983 { 983 {
984 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); 984 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error);
985 } 985 }
986 986
987 } // namespace blink 987 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698