Commit Graph

3912 Commits

Author SHA1 Message Date
James Zern
bc5092b162 pngdec: set memory functions
use png_create_read_struct_2 to set a malloc function allowing the code
to fail on large allocations while fuzzing

Change-Id: Iaca1b93ecc6570067708f3ae2db07fbca74386ee
2018-09-28 00:35:47 -07:00
Vincent Rabaud
50d8345ae6 Fix CMake math library.
Just in case we have a warning.

Change-Id: I5f2aabf5f4adaaf9ba6c4fbbbf352603259e8081
2018-09-21 15:40:40 +02:00
Vincent Rabaud
6aa3e8aaf3 Fix math library on Visual Studio.
The code was compiled but optimized, and no math function
was used.

Change-Id: Ib2ab262c072761ec41df8f9260a1e0fe57d01cef
2018-09-11 18:28:44 +02:00
Vincent Rabaud
d71df4e2ee Fix math library finding in CMake.
BUG=webp:396

Change-Id: I8ca35573c242cba24f1e82997b4fb289a48a3005
2018-09-03 14:35:50 +00:00
James Zern
de08d72741 cosmetics: normalize include guard comment
Change-Id: I0e08ec604aad8412cfe3d3670d773f4ae5650375
2018-08-22 14:46:53 -07:00
Yannis Guyon
009562b403 vwebp: Fix bug when Dispose then NoBlend frames
The graphical bug happens when there is a frame disposed to background
color, followed by another frame that does not blend, and their areas
don't fully overlap. Only the previous frame clears its part of the
viewport. The fix consists in clearing the screen for the previous and
the current frame if needed.

Change-Id: I3425cf7297f0c7b2cf13a3a61b517cc0b1c031d8
2018-08-03 14:15:13 -07:00
Vincent Rabaud
423f257930 Fix up CMake to create targets.
Change-Id: I4b0b71d0ab7e49e237bd928de690915cc3b86be2
2018-07-25 14:04:18 +02:00
Vincent Rabaud
907208f97e Wait for all threads to be done in DecodeRemaining.
This could lead to a race condition.

BUG=oss-fuzz:9417

Change-Id: Ifef4001115888541cb76095e1c0226487d497b78
2018-07-20 17:03:01 -07:00
Yannis Guyon
4649b3c422 vwebp: Add background color display option
Option -usebgcolor may be used to display ANIM background color (or white if no ANIM chunk), blended on top of checkerboard. By default this is disabled (old behavior) to easily see transparent areas. Spec says that "background color MAY be used", so it's an option.
Key b may be pressed to toggle ANIM background color display. There are visual artifacts (leftovers) when toggling during an animation. This is already the case for rescaling, toggling info etc. (fixing it implies storing viewport render or rendering whole animation from start till current frame).

BUG=webp:394

Change-Id: If9ab898b2eac77226f30f062d522f9861789ef8f
2018-07-20 12:54:30 +02:00
Yannis Guyon
78ad57a36a Fix bad glClearColor parameters
Container spec indicates that background color is written
in BGRA byte order, but glClearColor() parameters are RGBA.
Anyway the checkerboard is displayed right after glClear()
calls so it replaces background color.

In response to webp-discuss/TkLHALGaHaM

Change-Id: Ief5435fadfd6a422b881a9dc240b5e8dc6546e19
2018-07-18 10:50:33 +02:00
Vincent Rabaud
da96d8d9ab Allow for a non-initialized alpha decompressor in DoRemap.
BUG=oss-fuzz:9364

Change-Id: Ib1a1c6b0ccfcc255505f019e3e8fd15db73bc4b6
2018-07-13 22:09:06 +02:00
Pascal Massimino
2563db4759 fix rescaling rounding inaccuracy
We should be using 'floor' when doing the final divide.

-> new MACRO is MULT_FIX_FLOOR()

     XXX*** Mips code is DISABLED for now ***XXX

I'll update and re-enable it in a later
patch, since this code needs some refactoring first.

BUG=oss-fuzz:9179

Change-Id: Ic0693cdca4e71f5beab1029475e35c4d06b12d13
2018-07-10 22:45:50 -07:00
Pascal Massimino
211f37ee63 fix endian problems in pattern copy
CopyBlock8b() was over-using memcpy() of 16b values.

BUG=webp:393

Change-Id: Id56f10d334b9a453fbcf50dabfaa63529bcff7e5
2018-07-10 05:15:26 +00:00
Vincent Rabaud
5f0f5c07c4 Make sure partition #0 is read before VP8 data in IDecode.
Change-Id: Ie0b264b6422774343206ddba3c2820a0cf37ffc0
2018-07-09 20:20:52 +02:00
Pascal Massimino
de98732b04 fix GetColorf() bug
We should only use the lower 8 bits, masking was missing.

Change-Id: I3072168e100b242356ad57b5a73b7f4d6ebfbb9e
2018-07-06 21:25:41 -07:00
Yannis Guyon
4338cd36fe misc fixes in libwebpmux
* Assert chunklist
  * fix potential memory leak and
  * fix null pointer access

There should not be several alpha_ or img_ chunks in SynthesizeBitstream. Use ChunkListDelete in MuxImageRelease to be safe.
A null pointer accessed in WebPMuxPushFrame triggered a harmless runtime error.

Change-Id: I3027f8752093652bd41f55e667d041c0de77ab6e
2018-07-04 19:03:21 +00:00
Pascal Massimino
e00af13ef4 fix signatures after a9ceda7ff1
fixes vs10_x64 build.

Change-Id: I636e6a5bea1239bacdaa4d160be1d645636c3ae8
2018-07-04 06:03:37 +00:00
Vincent Rabaud
a9ceda7ff1 Speed-up chunk list operations.
The chunk list only has two operations: append and set
to one element. The two operations are split and the append
one is sped up by storing the last element.
Corrupted data could make a very long list to search through.

BUG=oss-fuzz:9190

Change-Id: I1aa813ca629df29efaa3b46dbd4c4c42dbeaa34c
2018-07-03 16:36:34 +02:00
Vincent Rabaud
2281bbf6f7 Merge "Better handling of bogus Huffman codes." 2018-07-03 08:33:35 +00:00
Vincent Rabaud
39cb9aad85 Better handling of bogus Huffman codes.
The standard allows for Huffman images with any coefficients.
Hence potentially big memory allocations. The previous workaround
was "trying" things out, the new one is more rigorous and
only allocates what is needed, modifying the Huffman image
to contain the minimal set of coefficients.

BUG=oss-fuzz:8623,oss-fuzz:9111,oss-fuzz:9134

Change-Id: I6a972e90e4ae509c15cb41ee22c58b775fa3f4aa
2018-07-03 10:00:52 +02:00
Pascal Massimino
89cc9d3787 Merge "fix read-overflow while parsing VP8X chunk" 2018-07-03 03:06:42 +00:00
Pascal Massimino
95fd650706 fix read-overflow while parsing VP8X chunk
The available size was not checked before parsing the VP8X data

BUG=oss-fuzz:9100,oss-fuzz:9123

Change-Id: I0143cc4554883c1015e2f084a0e371229e04a8ca
2018-07-03 02:36:25 +00:00
Yannis Guyon
9e729fe19b Fix VP8IoTeardownHook being called twice on worker sync failure
idec_dec.c, DecodeRemaining: Set decoder state to ERROR to prevent VP8ExitCritical to be called again

Change-Id: Id5f893f45c348e1c529680d930e640f780a73d4c
2018-07-02 13:37:46 +02:00
James Zern
29fb8562c6 Merge "muxread,anmf: fail on multiple image chunks" 2018-06-30 04:25:20 +00:00
James Zern
eb82ce76dd muxread,anmf: fail on multiple image chunks
treat an ANMF chunk containing multiple VP8/VP8L file as malformed.
fixes a WebPMuxImage::img_ leak.

Though the invalid free in #9106 was avoided in (ubsan):
be738c6d muxread,ChunkVerifyAndAssign: validate chunk_size
that file would still cause a leak similar to #9099.

BUG=oss-fuzz:9099,oss-fuzz:9106

Change-Id: Ib873446a1188afeeb2fe5d53a86b75e0c5de9573
2018-06-29 17:52:58 -07:00
Pascal Massimino
1344a2e947 fix alpha-filtering crash when image width is larger than radius
(we also limit radius based on height too, for good measure, although it's not an asan bug)

fixes oss-fuzz issue #9105

Change-Id: Ie0d79dd81480dc4e2b653b7e992e5cdcd3dfa834
2018-06-29 11:02:17 -07:00
James Zern
be738c6d39 muxread,ChunkVerifyAndAssign: validate chunk_size
before accounting for padding which might overflow if chunk_size is >
MAX_CHUNK_PAYLOAD.

BUG=webp:387,webp:388

Change-Id: I3985b8817ed4faaec0629102c5333c228a0e9c98
2018-06-20 18:21:48 -07:00
James Zern
2c70ad76c9 muxread,CreateInternal: fix riff size checks
previously when adjusting size down based on a smaller riff_size the
checks were insufficient to prevent 'size -= RIFF_HEADER_SIZE' from
rolling over causing ChunkVerifyAndAssign to over read. the new checks
are imported from demux.c.

BUG=webp:386

Change-Id: If863c4a9892977b9ade7dd894392a0ecae13775c
2018-06-14 18:06:44 -07:00
Yannis Guyon
569001f19f Fix for thread race heap-use-after-free
BUG=webp:384

Change-Id: I3a300b45ccae33470888cf2e35a7e937579c9409
2018-06-13 10:45:12 +02:00
James Zern
c56a02d971 Android.mk: use LOCAL_EXPORT_C_INCLUDES w/public libs
dependents can then pickup the include path for webp/ automatically

Change-Id: Ie768a93d0054f8ebc1720f16fbb550c0b10ef61d
2018-06-07 16:12:58 -07:00
James Zern
1579559662 CMakeLists.txt,cosmetics: normalize if() formatting
+ break a long line

Change-Id: Ia508d517e89dd2109b655c220b66d8aa834a3b52
2018-06-05 09:27:08 -07:00
Vincent Rabaud
1a44c233b9 Merge "cmake: add support for webpmux" 2018-06-05 12:54:53 +00:00
James Zern
e9569ad708 Merge "configure,*am,cosmetics: s/WANT_/BUILD_/" 2018-06-04 23:23:36 +00:00
James Zern
35c7de6fc4 cmake: add support for webpmux
Change-Id: Ia694ba49549c43956f6552e6981a46df0fe7e686
2018-06-04 15:44:04 -07:00
Pascal Massimino
0f25e61c13 WebpToSDL(): fix the return value in case of error
spotted Diego Casorran

Change-Id: I48822ade22eb8fcef85043a84d712e892324476d
2018-06-04 09:51:53 +02:00
James Zern
5d8985de47 configure,*am,cosmetics: s/WANT_/BUILD_/
'BUILD_' is more common across the build files

Change-Id: Id302dba2e9e567c186a9da1da0fba44517e85d07
2018-06-02 10:41:49 -07:00
James Zern
895fd28f9b Merge "man/Makefile.am: add img2webp.1" 2018-06-02 17:37:04 +00:00
James Zern
5cf3e2afb5 man/Makefile.am: add img2webp.1
Change-Id: I83ed6e85d36b79e6a97b93221fadb7d35e2305c5
2018-06-01 19:25:53 -07:00
Alan Browning
2a9de5b9d3 Add build rules for anim_diff & anim_dump utils.
Change-Id: I2697a6dc3c419a19909262003a6d6a263d3c2747
2018-06-01 19:23:47 -07:00
Pascal Massimino
71ed73cf86 fix invalid check for buffer size
BUG=webp:383

Change-Id: I8ebbb5ca4860d73c3b59b12e238b54a89184bed0
2018-05-25 13:25:39 +02:00
James Zern
af0e4fbb06 gif2webp: fix transcode of loop count=65535
with loop_compatibility disabled (the default), non-zero loop counts
will be incremented by 1 for browser rendering compatibility. the max,
65535, is a special case as the muxer will fail if it is exceeded; avoid
increasing the limit in this case. this isn't 100% correct, but should
be close enough given the high number of iterations.

BUG=webp:382

Change-Id: Icde3e98a58e9ee89604a72fafda30ab71060dec5
2018-05-11 12:10:25 -07:00
Vincent Rabaud
dce5d76431 Limit memory allocation when reading invalid Huffman codes.
BUG=webp:381

Change-Id: I6b68a33689a3309691eba582b759131b81b612c1
2018-05-03 13:53:44 +02:00
James Zern
f9df0081a7 Merge "cmake: quiet glut deprecation warnings on OS X" 2018-04-25 18:45:52 +00:00
James Zern
dc39b16fe4 webpmux.1: correct grammar
argument -> arguments

Change-Id: I57132c942150f18dccc5ef84c4c09a6dcc054ffa
2018-04-23 16:06:54 -07:00
Pascal Massimino
c7aa1264f0 cwebp.c: fix a missing \n
+ lot more coverage of exotic options and combinations

Change-Id: I4d8e571a6d94023af9848a2bbd98edda05a54f33
2018-04-23 15:45:41 -07:00
James Zern
53aa51e9a3 libwebp-1.0.0
- 4/2/2018: version 1.0.0
   This is a binary compatible release.
   * lossy encoder improvements to avoid chroma shifts in various circumstances
     (issues #308, #340)
   * big-endian fixes for decode, RGBA import and WebPPictureDistortion
   Tool updates:
     gifwebp, anim_diff - default duration behavior (<= 10ms) changed to match
                          web browsers, transcoding tools (issue #379)
     img2webp, webpmux - allow options to be passed in via a file (issue #355)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEaw5rcJdt4wPt8vYB+cPWvbgjK10FAlrasfkACgkQ+cPWvbgj
 K12DGg//W62o9nLkWK3196sJW57z1/4kPFj3q2syxDfPvgu8A8RcFbLADXxacNsD
 l3eR36wIG6VnJlI4DzoPn5uipvJCsDqysNRm4G6zBWc4wmycKBIwDz85i/2kJbG1
 bXDK6yICh4Keg3eZq6dprZhSFQzi1MjQKtvfshU+rKC0UxaTzGDfc4qqn9df9468
 a6xDrSw5lJ2cQs8BNAeLUJrziXaP1EnJuU1vvH9cDjQqVz02BE/o9EY3Pv8pL26h
 3bzTiIf7v0tt0pPdzm+P5nQ0BCKkVVlzIqDn7E4ORZhbFAj3AVJPB3/7Y9YrL6/y
 BGl94RNqlrzgCmPtkyTmFkOmIr/rQBgIbqS6KJ1mkS0qfwad/FXaEUAMz3yMO5xO
 06NRXLhyREdPS678t9sp+epw+aHcxOgDZzgr8ghSufirSa6og7gyseGq+FHZ7R6d
 R0dQknk6xbJc59tdKhVFO1Nc7acQWPzIY9KPmLUA5Ag3ooJFd65jUxQ8icn7NqyZ
 +lh3CQhRF0mug9GNHBbtc6xn15mG59nGZp8NWW4UcqHOgzIQuHJS29ZH1j6wO3+O
 iEuR3BmuagngN2Dpw+C2XJoT/qrO2GSndLSVJW6QTTCod9RCTZpc0ik6gAmPAgL1
 ueYBuhzZyb1Dtdte377fRMfjpOezZUh6G0rFs4yQx9O4SXh/3xY=
 =Uvya
 -----END PGP SIGNATURE-----

Merge tag 'v1.0.0'

libwebp-1.0.0

- 4/2/2018: version 1.0.0
  This is a binary compatible release.
  * lossy encoder improvements to avoid chroma shifts in various circumstances
    (issues #308, #340)
  * big-endian fixes for decode, RGBA import and WebPPictureDistortion
  Tool updates:
    gifwebp, anim_diff - default duration behavior (<= 10ms) changed to match
                         web browsers, transcoding tools (issue #379)
    img2webp, webpmux - allow options to be passed in via a file (issue #355)

* tag 'v1.0.0': (23 commits)
  update ChangeLog
  webp-container-spec: correct frame duration=0 note
  vwebp: Copy Chrome's behavior w/frame duration == 0
  update ChangeLog
  add WEBP_DSP_INIT / WEBP_DSP_INIT_FUNC
  fix 16b overflow in SSE2
  makefile.unix: add DEBUG flag for compiling w/ debug-symbol
  cwebp,get_disto: fix bpp output
  cmake: Make sure we use near-lossless by default.
  fix bug in WebPImport565: alpha value was not set
  update ChangeLog
  Revert "Use proper targets for CMake."
  Use proper targets for CMake.
  Remove some very hard TODOs.
  {de,}mux/Makefile.am: add missing headers
  makefile.unix,dist: use ascii for text output
  add -version option to anim_dump,anim_diff and img2webp
  webp_js: fix webp_js demo html
  update ChangeLog
  update AUTHORS
  ...

Change-Id: I5659406c022a0964f728ce2eb35338fd9c195466
2018-04-23 14:54:39 -07:00
James Zern
698b8844e3 update ChangeLog
Change-Id: Ica00314a3dfacad89ec62a3dc2df0d476e6397af
2018-04-20 20:04:55 -07:00
James Zern
8d510751da webp-container-spec: correct frame duration=0 note
the interpretation of a 0 duration depends on the implementation;
merging of multiple frames isn't guaranteed, some may enforce a minimum
duration.

BUG=webp:380

Change-Id: Idf592049d2092e4cc5cfb2e4c59ddbc91bd52f9c
(cherry picked from commit 71c39a06c8)
2018-04-20 19:59:21 -07:00
Vincent Rabaud
e6b2164e3a vwebp: Copy Chrome's behavior w/frame duration == 0
BUG=webp:380

Change-Id: Ia0b108d7da755ff91cf6c84581412e47a3a6e5d9
(cherry picked from commit fd3d5756cb)
2018-04-20 19:59:15 -07:00
James Zern
094b3b285b cmake: quiet glut deprecation warnings on OS X
BUG=webp:187

Change-Id: I652b474dc8389b2219a424d43dec80c3bf9ba62c
2018-04-20 19:57:16 -07:00