• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <memory>
6 #include <utility>
7 
8 #include "core/fpdfapi/parser/cpdf_dictionary.h"
9 #include "core/fpdfapi/parser/cpdf_number.h"
10 #include "core/fpdfapi/parser/cpdf_stream.h"
11 #include "core/fpdfapi/render/cpdf_dibsource.h"
12 #include "core/fxcrt/fx_memory.h"
13 #include "core/fxge/dib/dib_int.h"
14 #include "core/fxge/fx_dib.h"
15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/base/ptr_util.h"
17 
TEST(CStretchEngine,OverflowInCtor)18 TEST(CStretchEngine, OverflowInCtor) {
19   FX_RECT clip_rect;
20   std::unique_ptr<CPDF_Dictionary> dict_obj =
21       pdfium::MakeUnique<CPDF_Dictionary>();
22   dict_obj->SetNewFor<CPDF_Number>("Width", 71000);
23   dict_obj->SetNewFor<CPDF_Number>("Height", 12500);
24   std::unique_ptr<CPDF_Stream> stream =
25       pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj));
26   CPDF_DIBSource dib_source;
27   dib_source.Load(nullptr, stream.get());
28   CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect,
29                         &dib_source, 0);
30   EXPECT_EQ(FXDIB_INTERPOL, engine.m_Flags);
31 }
32