msan: define BREAK_IF_DEBUGGING_AND_OUT_OF_RANGE in piex
authormtklein <mtklein@chromium.org>
Mon, 8 Feb 2016 17:35:05 +0000 (09:35 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 8 Feb 2016 17:35:05 +0000 (09:35 -0800)
This should assert(false) if we're in the error case of RangeCheckedBytePtr::extractBytes:

> #ifdef BREAK_IF_DEBUGGING_AND_OUT_OF_RANGE
>   #define BREAK_IF_DEBUGGING() assert(false)
> #else
>   #define BREAK_IF_DEBUGGING() assert(true)
> #endif
  ...
> std::vector<unsigned char> RangeCheckedBytePtr::extractBytes(size_t pos, size_t length) const {
>   std::vector<unsigned char> result;
>   if (pos + length < pos /* overflow */ || remainingLength() < pos + length) {
>     BREAK_IF_DEBUGGING();
>     error_flag_ = RANGE_CHECKED_BYTE_ERROR_OVERFLOW;
>     return result;
>   }
  ...

BUG=skia:4903
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1678913002

Review URL: https://codereview.chromium.org/1678913002

gyp/piex.gyp

index b2a1f36ce859ca3a8dcdc911c7f13ae0a38c9c77..630ccfe05d2f13af1d040643e74090b153c2df90 100644 (file)
@@ -35,6 +35,7 @@
     '../third_party/externals/piex/src/tiff_directory/tiff_directory.cc',
     '../third_party/externals/piex/src/tiff_parser.cc',
   ],
+  'defines': [ 'BREAK_IF_DEBUGGING_AND_OUT_OF_RANGE' ],
   'include_dirs': [ '../third_party/externals/piex' ],
   'direct_dependent_settings': {
     'include_dirs': [ '../third_party/externals/piex' ],