Commit Graph

105 Commits (e1f02d2833a7de496e4c148206f421cd664f0d56)

Author SHA1 Message Date
Mike Frysinger e1f02d2833 gd_intern: unify the min/max/clamp macros some more 2021-02-05 22:47:13 -05:00
willson-chen ce00fbff0e Move initial declaration out of `for` loop
'for' loop initial declarations are only allowed in C99 mode.
2020-03-25 11:41:44 +08:00
wilson chen 3f50ffaefd
Fixed #596: gdTransformAffineCopy run error
And add test case for it.
2020-03-21 15:31:40 +08:00
Christoph M. Becker a9e66268f9 Fix #586: gdTransformAffineCopy() segfaults on palette images
We have to properly distinguish between truecolor and palette images.
2020-01-05 00:21:08 +01:00
Christoph M. Becker 9088591eae Fix #585: gdTransformAffineCopy() changes interpolation method
We have to properly initialize `interpolation_id_bak`.
2020-01-04 23:43:47 +01:00
Christoph M. Becker 6d21d30429 Fix #584: gdImageSetInterpolationMethod(im, GD_DEFAULT) inconsistent
We have to avoid the unintended fall through.
2020-01-04 19:06:51 +01:00
Christoph M. Becker 7a06c1669c Fix #583: gdTransformAffineCopy() may use unitialized values
We have to check the return value of `gdAffineInvert()`, and on failure
let `gdTransformAffineCopy()` fail as well.
2020-01-04 19:06:51 +01:00
Christoph M. Becker 0414bb2da0 Fix misleading variable type
`m` and `n` are supposed to be plain integers, so we shouldn't declare
them as `gdFixed`.
2019-01-10 23:26:09 +01:00
Mike Frysinger fd06f7f83c clean up trailing whitespace/newlines
This is preparation for adding some linting checks for new commits from
people.  Shouldn't be any functional changes here (tests still pass!).
2018-06-21 22:47:42 -04:00
Christoph M. Becker 60bfb401ad Fix potential unsigned underflow
No need to decrease `u`, so we don't do it. While we're at it, we also factor
out the overflow check of the loop, what improves performance and readability.

This issue has been reported by Stefan Esser to security@libgd.org.
2016-12-13 15:16:03 +01:00
Christoph M. Becker ca2b34e1f8 Fix #329: GD_BILINEAR_FIXED gdImageScale() can cause black border
We're passing `pixel1` as default color to `getPixelOverflow*()` for
pixels which may be outside the valid bounds. `pixel1` is supposed to
be always valid due to the fixed arithmetic's round towards zero
behavior.
2016-10-10 12:45:13 +02:00
Christoph M. Becker 77c8d359bb Fix #330: Integer overflow in gdImageScaleBilinearPalette()
The color components are supposed to be in range 0..255, so we must not
cast them to `signed char`, what can be the default for `char`.
2016-10-10 11:05:27 +02:00
Christoph M. Becker b6b44d962d Document that gdImageScale() does not yet support GD_WEIGHTED4 2016-10-09 18:21:31 +02:00
Christoph M. Becker 0c0cd18aff Revert "Fix #328: gdImageScale() with GD_WEIGHTED4 always returns NULL"
This reverts commit 0809c9f644.
2016-10-09 18:17:03 +02:00
Christoph M. Becker 0809c9f644 Fix #328: gdImageScale() with GD_WEIGHTED4 always returns NULL
Actually, there is no special case implementation for GD_WEIGHTED4
interpolation yet, so we must not pretend there would.
2016-10-09 16:25:07 +02:00
Christoph M. Becker b697bf74db Document cloning, copying, scaling and interpolation 2016-10-06 15:50:16 +02:00
Christoph M. Becker 1b6564cdc8 Fix 321: Null pointer dereferences in gdImageRotateInterpolated
We let gdImageRotateInterpolated() fail early, if `src` is NULL.
2016-10-06 14:20:24 +02:00
Christoph M. Becker 65d40f5aa5 Fix #319: gdImageRotateInterpolated can have wrong background color
We backport the fix for <https://bugs.php.net/65070>, and also the fix for
<https://bugs.php.net/70976> which was introduced by fixing 65070.
2016-10-03 16:19:19 +02:00
Christoph M. Becker 88302603ef Fix unnecessary non NULL checks
Coverity rightly complains that `tmp_img` is checked for being `!= NULL`,
*after* it has been dereferenced[1]. Actually, the `NULL` check is not
necessary at all. To be on the safe side, we assert that `src != NULL` when
`gdImageScaleTwoPass()` has been called.

[1] <https://scan8.coverity.com/reports.htm#v30161/p11047/fileInstanceId=12793299&defectInstanceId=4423754>
2016-08-15 18:16:12 +02:00
Christoph M. Becker 28440a4087 Remove superfluous if statement 2016-07-23 19:16:14 +02:00
Christoph M. Becker f101380bc6 Fix copy&paste error in gdImageScaleBicubicFixed() 2016-07-23 17:51:21 +02:00
Christoph M. Becker b0333689ef Document all BGD_DECLARE'd functions
We add only minimal documentation comments for now, but at least that lets
Natural Docs add the function prototypes to the documentation.
2016-07-20 21:24:48 +02:00
Christoph M. Becker 8b7e76dd37 Fix typo introduced in 0dd1706 2016-07-20 13:27:30 +02:00
Pierre Joye 0dd1706c14 possible null deref 2016-07-20 17:00:16 +07:00
Pierre Joye 7a28c23589 fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 17:05:54 +07:00
Pierre Joye f60ec7a546 fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 16:30:52 +07:00
Pierre Joye ff9113c80a fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 15:57:08 +07:00
Pierre Joye d325888a9f fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 15:25:47 +07:00
Pierre Joye add4733944 Merge branch 'master' of github.com:libgd/libgd 2016-07-19 14:46:08 +07:00
Pierre Joye 0dd40abd6d fix possible OOB or OOM in gdImageScale, reported by Secunia (CVE 2016-6207) 2016-07-19 14:45:56 +07:00
Pierre Joye 118fc7098b php bug 72519, invalid color index for transparent color can lead to OOB 2016-07-19 14:38:26 +07:00
Pierre Joye 89520807f1 Merge branch 'GD-2.2'
* GD-2.2:
  fix CID 95839
  update
2016-06-24 09:45:08 +07:00
Pierre Joye 68a9c79e7c fix CID 95839 2016-06-24 09:44:44 +07:00
Pierre Joye 3ac1d291e3 Merge branch 'GD-2.2'
* GD-2.2:
  fix CID 95839, fix logic and avoid duplicate code (and confusion)
  Add coverity status
2016-06-21 14:40:19 +07:00
Pierre Joye 9d4d314701 fix CID 95839, fix logic and avoid duplicate code (and confusion) 2016-06-21 14:00:32 +07:00
Pierre Joye a280b5c38d Merge branch 'GD-2.2'
* GD-2.2:
  fix CID 95837 duplicate code
2016-06-21 12:26:20 +07:00
Pierre Joye fa1e9b7612 fix CID 95837 duplicate code 2016-06-21 12:24:35 +07:00
Pierre Joye 493283ee2d Merge branch 'GD-2.2'
* GD-2.2:
  fix #232, set output argument dst to NULL on errror
2016-06-15 17:58:08 +07:00
Pierre Joye 81d94b1c66 fix #232, set output argument dst to NULL on errror 2016-06-15 17:57:50 +07:00
Pierre Joye 34b705b0ce Merge branch 'GD-2.2'
* GD-2.2:
  fix 232, set output argument dst to NULL on errror
2016-06-15 17:18:05 +07:00
Pierre Joye 02c6925404 fix 232, set output argument dst to NULL on errror 2016-06-15 17:17:20 +07:00
Pierre Joye e5dd556cbd let try again to make gcc/clang on travis happy. ok, cherrypicking next time. 2016-06-15 13:31:30 +07:00
Pierre Joye bd44bce836 Merge branch 'GD-2.2'
* GD-2.2:
  let try again to make gcc/clang on travis happy...
2016-06-15 13:14:39 +07:00
Pierre Joye 8b32817401 let try again to make gcc/clang on travis happy... 2016-06-15 13:14:14 +07:00
Pierre Joye b21c42bfd6 Merge branch 'GD-2.2'
* GD-2.2:
  fix build --enable-werror
2016-06-15 12:42:44 +07:00
Pierre Joye 8ad45d4de0 fix build --enable-werror 2016-06-15 12:39:40 +07:00
Pierre Joye 50d8b568e4 Merge branch 'GD-2.2'
* GD-2.2:
  fix build (warning as error). Now why it does not happen with gcc... todo++
2016-06-15 12:04:01 +07:00
Pierre Joye 9df878a400 fix build (warning as error). Now why it does not happen with gcc... todo++ 2016-06-15 12:03:37 +07:00
Pierre Joye e22448e6dd Merge branch 'GD-2.2'
* GD-2.2:
  fix #227 drop usage of GD_BILINEAR_FIXED and GD_BICUBIC_FIXED for gdImageRotateInterpolated, the quality does not match expectation. It is also trickier to maintain for little gain. The generic method is used and will be optimized for 2.3 to match fixed pt performance, if necessary. Also use png for comparison to avoid jpeg artifact, making impossible to exactly  compare results
  fix #227 drop usage of GD_BILINEAR_FIXED and GD_BICUBIC_FIXED for gdImageRotateInterpolated, the quality does not match expectation. It is also trickier to maintain for little gain. The generic method is used and will be optimized for 2.3 to match fixed pt performance, if necessary. Also use png for comparison to avoid jpeg artifact, making impossible to exactly  compare results
  fix #227 drop usage of GD_BILINEAR_FIXED and GD_BICUBIC_FIXED for gdImageRotateInterpolated, the quality does not match expectation. It is also trickier to maintain for little gain. The generic method is used and will be optimized for 2.3 to match fixed pt performance, if necessary. Also use png for comparison to avoid jpeg artifact, making impossible to exactly  compare results
  WS
  #230 fix crash on fail
  gdTestAssert should not accept any message. Also crashes if assert failed

Conflicts:
	tests/gdimagerotate/bug00067.c
	tests/gdtest/gdtest.c
2016-06-15 09:53:28 +07:00
Pierre Joye bd6d2e101f fix #227 drop usage of GD_BILINEAR_FIXED and GD_BICUBIC_FIXED for gdImageRotateInterpolated, the quality does not match expectation. It is also trickier to maintain for little gain. The generic method is used and will be optimized for 2.3 to match fixed pt performance, if necessary. Also use png for comparison to avoid jpeg artifact, making impossible to exactly compare results 2016-06-15 09:38:22 +07:00