Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: src/codec/SkBmpRLECodec.cpp

Issue 2391933004: Fix bmp bug exposed by fuzzer (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBmpRLECodec.h" 8 #include "SkBmpRLECodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 numPixels--; 444 numPixels--;
445 break; 445 break;
446 case 24: { 446 case 24: {
447 SkASSERT(fCurrRLEByte + 2 < fRLEBytes); 447 SkASSERT(fCurrRLEByte + 2 < fRLEBytes);
448 uint8_t blue = fStreamBuffer.get()[fCurrRLEByte+ +]; 448 uint8_t blue = fStreamBuffer.get()[fCurrRLEByte+ +];
449 uint8_t green = fStreamBuffer.get()[fCurrRLEByte ++]; 449 uint8_t green = fStreamBuffer.get()[fCurrRLEByte ++];
450 uint8_t red = fStreamBuffer.get()[fCurrRLEByte++ ]; 450 uint8_t red = fStreamBuffer.get()[fCurrRLEByte++ ];
451 setRGBPixel(dst, dstRowBytes, dstInfo, 451 setRGBPixel(dst, dstRowBytes, dstInfo,
452 x++, y, red, green, blue); 452 x++, y, red, green, blue);
453 numPixels--; 453 numPixels--;
454 break;
454 } 455 }
455 default: 456 default:
456 SkASSERT(false); 457 SkASSERT(false);
457 return y; 458 return y;
458 } 459 }
459 } 460 }
460 // Skip a byte if necessary to maintain alignment 461 // Skip a byte if necessary to maintain alignment
461 if (!SkIsAlign2(rowBytes)) { 462 if (!SkIsAlign2(rowBytes)) {
462 fCurrRLEByte++; 463 fCurrRLEByte++;
463 } 464 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 fSampler.reset(new SkBmpRLESampler(this)); 548 fSampler.reset(new SkBmpRLESampler(this));
548 } 549 }
549 550
550 return fSampler; 551 return fSampler;
551 } 552 }
552 553
553 int SkBmpRLECodec::setSampleX(int sampleX){ 554 int SkBmpRLECodec::setSampleX(int sampleX){
554 fSampleX = sampleX; 555 fSampleX = sampleX;
555 return get_scaled_dimension(this->getInfo().width(), sampleX); 556 return get_scaled_dimension(this->getInfo().width(), sampleX);
556 } 557 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698