OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "core/fxcodec/codec/codec_int.h" | 10 #include "core/fxcodec/codec/codec_int.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 } | 383 } |
384 } | 384 } |
385 } | 385 } |
386 a1 = b1 + v_delta; | 386 a1 = b1 + v_delta; |
387 if (!a0color) | 387 if (!a0color) |
388 FaxFillBits(dest_buf, columns, a0, a1); | 388 FaxFillBits(dest_buf, columns, a0, a1); |
389 | 389 |
390 if (a1 >= columns) | 390 if (a1 >= columns) |
391 return TRUE; | 391 return TRUE; |
392 | 392 |
| 393 // The position of picture element must be monotonic increasing. |
| 394 if (a0 >= a1) |
| 395 return FALSE; |
| 396 |
393 a0 = a1; | 397 a0 = a1; |
394 a0color = !a0color; | 398 a0color = !a0color; |
395 } | 399 } |
396 } | 400 } |
397 | 401 |
398 FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) { | 402 FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int* bitpos) { |
399 int startbit = *bitpos; | 403 int startbit = *bitpos; |
400 while (*bitpos < bitsize) { | 404 while (*bitpos < bitsize) { |
401 int bit = NEXTBIT(); | 405 int bit = NEXTBIT(); |
402 if (!bit) | 406 if (!bit) |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 return nullptr; | 606 return nullptr; |
603 | 607 |
604 // Reject unreasonable large input. | 608 // Reject unreasonable large input. |
605 if (actual_width > kMaxImageDimension || actual_height > kMaxImageDimension) | 609 if (actual_width > kMaxImageDimension || actual_height > kMaxImageDimension) |
606 return nullptr; | 610 return nullptr; |
607 | 611 |
608 uint32_t pitch = (static_cast<uint32_t>(actual_width) + 31) / 32 * 4; | 612 uint32_t pitch = (static_cast<uint32_t>(actual_width) + 31) / 32 * 4; |
609 return new CCodec_FaxDecoder(src_buf, src_size, actual_width, actual_height, | 613 return new CCodec_FaxDecoder(src_buf, src_size, actual_width, actual_height, |
610 pitch, K, EndOfLine, EncodedByteAlign, BlackIs1); | 614 pitch, K, EndOfLine, EncodedByteAlign, BlackIs1); |
611 } | 615 } |
OLD | NEW |