skia2/gyp/piex.gyp
mtklein 6fd4e44e23 msan: define BREAK_IF_DEBUGGING_AND_OUT_OF_RANGE in piex
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
2016-02-08 09:35:05 -08:00

48 lines
1.8 KiB
Python

# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
'targets': [{
'target_name': 'piex-selector',
'type': 'none',
'conditions': [
[ 'skia_android_framework', {
'dependencies': [ 'android_deps.gyp:libpiex' ],
'export_dependent_settings': [ 'android_deps.gyp:libpiex' ],
}, {
'dependencies': [ 'piex.gyp:piex' ],
'export_dependent_settings': [ 'piex.gyp:piex' ],
}]
]
},{
'target_name': 'piex',
'type': 'static_library',
'sources': [
'../third_party/externals/piex/src/binary_parse/cached_paged_byte_array.cc',
'../third_party/externals/piex/src/binary_parse/range_checked_byte_ptr.cc',
'../third_party/externals/piex/src/image_type_recognition/image_type_recognition_lite.cc',
'../third_party/externals/piex/src/piex.cc',
'../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' ],
},
'cflags': [ '-w' ],
'msvs_settings': { 'VCCLCompilerTool': { 'WarningLevel': '0' } },
'xcode_settings': { 'WARNING_CFLAGS': ['-w'] },
}],
}