summaryrefslogtreecommitdiff
path: root/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
AgeCommit message (Collapse)Author
2018-10-12Forward declare more in codec code.Lei Zhang
Change-Id: I8060ada299f845a9198a6e83d31d128bd4bf09bc Reviewed-on: https://pdfium-review.googlesource.com/c/43870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Pass CFX_CodecMemory in place of spans to codecs.Tom Sepez
Next step towards making CFX_CodecMemory own the memory it is ref-counting. Change-Id: I5922d80d13032c3ea028447c47d34a10234109a3 Reviewed-on: https://pdfium-review.googlesource.com/c/43630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-31Remove avail_buf out argument from GetAvailInput() methods.chromium/3542chromium/3541chromium/3540chromium/3539Tom Sepez
It's always passed as nullptr. It's a good thing, too, since it looks like some of the implementations are returning a wrong pointer. Add some missing |const|s. Change-Id: I768048fdfe4cdd1dc838fee26fec18e024e39920 Reviewed-on: https://pdfium-review.googlesource.com/41810 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Use span<uint8_t> in more fxcodec code.Tom Sepez
There are also small tweaks in tests to ensure strict order of stack variable lifetimes. Change-Id: Ic9d5c6a2bdd378b517be627f8e29f725bafdc2ad Reviewed-on: https://pdfium-review.googlesource.com/41310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix shadowed variablesRyan Harrison
This CL fixes instances of variable shadowing that are discovered by turning on -Wshadow. BUG=pdfium:1137 Change-Id: I418d50de89ecbeb12e85b23a358bc61e8f16e888 Reviewed-on: https://pdfium-review.googlesource.com/41150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-08-13Implement CFX_CodecMemory.Lei Zhang
This class is much simpler than CFX_MemoryStream and does only what CFX_BmpDecompressor and CFX_GifContext needs. Swap out CFX_MemoryStream and remove CFX_MemoryStream::Seek(). BUG=pdfium:263 Change-Id: Ifd8ce4d2b6c9fedd6ec842d46f54fc8e654fbca7 Reviewed-on: https://pdfium-review.googlesource.com/39880 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-25Use incomplete type CFX_BmpContext in place of void*chromium/3503Tom Sepez
Allows killing off static_cast<> in two places. Change-Id: I467b69d92e8cbda5c2916b6ed2e97c173d8b4f2f Reviewed-on: https://pdfium-review.googlesource.com/38897 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-25Replace reinterpret_cast with static_cast where possibleTom Sepez
Change-Id: Ic62f1def8e043494c9fa6c08a937d7d872513567 Reviewed-on: https://pdfium-review.googlesource.com/31314 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-21Rename "des_foo" to "dest_foo".Lei Zhang
Destination variables usually have "dest" or "dst" as the prefix. Change-Id: If5bb01a5eafe1e4b42d1a6d653abb1b444b1b2fa Reviewed-on: https://pdfium-review.googlesource.com/28970 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-02-16Fix fallthroughs in XFA code.chromium/3350Henrique Nakashima
Change-Id: I1fd4bf85cd709de1c14ed2895d045018f79bc61f Reviewed-on: https://pdfium-review.googlesource.com/26950 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-02-15Correctly seek when header size is larger then expectedchromium/3349Ryan Harrison
BUG=chromium:811733 Change-Id: Idce50b8ea4ca06fc77d5b3931557cd1d6fe48bd5 Reviewed-on: https://pdfium-review.googlesource.com/26710 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-02-14Check that the request was satisfied in ReadDataRyan Harrison
Currently the BMP decompressor doesn't verify the returned data length was the amount requested. This means we may end up with part of our structure uninitialized if we didn't copy in enough data. This CL verifies the length of data copied is the size we require. BUG=chromium:811853 Change-Id: I20e0e9b3ff1176a620fcb38c3c7e585848b7e428 Reviewed-on: https://pdfium-review.googlesource.com/26850 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-13Change return value of GetAvailInputRyan Harrison
This changes the return value from uint32_t to FX_FILESIZE, which is the type the methods is uses return. The existing code does an unguarded static cast, so something like -1 could cause a very large value being returned. This change has a cascading impact up to the top of the progressive codec, which now has to handle negative values gracefully. Change-Id: I813fb71e932dd5da014dbaed0dbf3bb28f8d4e9f Reviewed-on: https://pdfium-review.googlesource.com/26450 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-12Convert CFX_BmpDecompressor to use CFX_MemoryStreamRyan Harrison
This also adds a Seek method to CFX_MemoryStream BUG=pdfium:1007 Change-Id: I2c7e1d3b6d8aff36e302014cb2e8ffc0f23ef7c4 Reviewed-on: https://pdfium-review.googlesource.com/26230 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-02-07Check that request sizes in ReadData don't overflowRyan Harrison
When a very large, bogus value, was being passed in for the number of bytes to read, this could cause an overflow in the check for if there is data available. BUG=chromium:809824 Change-Id: I54af6655b61d39275f3ae6fabb27be2bee3fef05 Reviewed-on: https://pdfium-review.googlesource.com/25871 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-02-06Account for skip size before getting image ifh sizeRyan Harrison
BUG=chromium:808336 Change-Id: I84443a00e2ebaf0a1e8590464486ec92bcb0e3b5 Reviewed-on: https://pdfium-review.googlesource.com/25690 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-02-06Extract classes in fx_bmp.h into their own filesRyan Harrison
BUG=chromium:808336 Change-Id: I3201805a374b5403149eca701714ef4369a2e337 Reviewed-on: https://pdfium-review.googlesource.com/25630 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>