| Index: printing/emf_win.cc
|
| diff --git a/printing/emf_win.cc b/printing/emf_win.cc
|
| index 8dde50351ce64c7b2d08a4ed3111179042fce79f..1bcc75d946f9b8d55e8df1639ac13f3779cf78a9 100644
|
| --- a/printing/emf_win.cc
|
| +++ b/printing/emf_win.cc
|
| @@ -14,6 +14,7 @@
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/numerics/safe_conversions.h"
|
| #include "base/win/scoped_gdi_object.h"
|
| #include "base/win/scoped_hdc.h"
|
| #include "base/win/scoped_select_object.h"
|
| @@ -186,9 +187,12 @@ bool Emf::Init() {
|
| return !!hdc_;
|
| }
|
|
|
| -bool Emf::InitFromData(const void* src_buffer, uint32_t src_buffer_size) {
|
| +bool Emf::InitFromData(const void* src_buffer, size_t src_buffer_size) {
|
| DCHECK(!emf_ && !hdc_);
|
| - emf_ = SetEnhMetaFileBits(src_buffer_size,
|
| + if (!base::IsValueInRangeForNumericType<UINT>(src_buffer_size))
|
| + return false;
|
| +
|
| + emf_ = SetEnhMetaFileBits(static_cast<UINT>(src_buffer_size),
|
| reinterpret_cast<const BYTE*>(src_buffer));
|
| return !!emf_;
|
| }
|
|
|