aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-30 14:40:38 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-30 14:40:38 +0000
commit57212f9469c8056bab3c85243dbb904e386eab95 (patch)
tree403c9f2ab9d20ab35397ab2e9dd9e2e6a27a441f /src/images
parent4ad4ae907fa83773f671137b0e4e8c9525ab81cd (diff)
This reverts commit 68b4b32066ea0ba9dbb5d326a836f8a54297b7aa. BUG= Review URL: https://codereview.chromium.org/122293002 git-svn-id: http://skia.googlecode.com/svn/trunk@12842 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageDecoder_libpng.cpp8
-rw-r--r--src/images/SkImageDecoder_libwebp.cpp7
2 files changed, 5 insertions, 10 deletions
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 02ba6af90a..3cc41e3f59 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -607,13 +607,9 @@ bool SkPNGImageDecoder::getBitmapConfig(png_structp png_ptr, png_infop info_ptr,
// sanity check for size
{
- Sk64 size;
- size.setMul(origWidth, origHeight);
- if (size.isNeg() || !size.is32()) {
- return false;
- }
+ int64_t size = sk_64_mul(origWidth, origHeight);
// now check that if we are 4-bytes per pixel, we also don't overflow
- if (size.get32() > (0x7FFFFFFF >> 2)) {
+ if (size < 0 || size > (0x7FFFFFFF >> 2)) {
return false;
}
}
diff --git a/src/images/SkImageDecoder_libwebp.cpp b/src/images/SkImageDecoder_libwebp.cpp
index 4a5951020e..05925d03a2 100644
--- a/src/images/SkImageDecoder_libwebp.cpp
+++ b/src/images/SkImageDecoder_libwebp.cpp
@@ -80,13 +80,12 @@ static bool webp_parse_header(SkStream* stream, int* width, int* height, int* al
// sanity check for image size that's about to be decoded.
{
- Sk64 size;
- size.setMul(*width, *height);
- if (size.isNeg() || !size.is32()) {
+ int64_t size = sk_64_mul(*width, *height);
+ if (!sk_64_isS32(size)) {
return false;
}
// now check that if we are 4-bytes per pixel, we also don't overflow
- if (size.get32() > (0x7FFFFFFF >> 2)) {
+ if (sk_64_asS32(size) > (0x7FFFFFFF >> 2)) {
return false;
}
}