Commit Graph

1133 Commits (8df65487ff0ba98771ed865be80a2d47c91fcc4b)

Author SHA1 Message Date
Pierre Joye e29a140290 revert, color is unsigned, <0 never happened 2016-07-20 16:40:17 +07:00
Pierre Joye bb16ba0297 Merge branch 'master' of github.com:libgd/libgd 2016-07-20 16:19:44 +07:00
Pierre Joye 7dfd79bbca improve color check for CropThreshold 2016-07-20 16:19:12 +07:00
Christoph M. Becker b4f985a11d Merge branch 'pull-request/262' 2016-07-19 13:56:49 +02:00
Christoph M. Becker a212f60114 Merge branch 'pull-request/261' 2016-07-19 12:13:18 +02:00
Pierre Joye b263053eac Merge branch 'master' of github.com:libgd/libgd 2016-07-19 17:07:17 +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
Christoph M. Becker 71f2ff370e Fix #264: TGA warning coverity
We fix the unintended sign extension issue #150385 by declaring encoded_pixels
as int, and the logical vs. bitwise operator issue #150382 by using the
proper operator.
2016-07-19 11:41:46 +02: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 d818ff9391 Merge branch 'master' of github.com:libgd/libgd 2016-07-19 14:38:59 +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
Christoph M. Becker e7e20d67d7 No pixel of a filled arc must ever be drawn multiple times
Otherwise we get artifacts regarding transparency. That happens with the
current implementation of gdImageFilledArc() unless gdChord or gdNoFill
are set. When gdPie is set, however, the filled arc is drawn in wedges,
which are polygons of three points, and so some overlap is natural.

To resolve the issue, we stick with the current algorithm of calculating the
wedges, but instead of drawing each polygon separately, we put the *relevant*
points in a large array, and draw a single polygon. That also is supposed to
improve the performance considerably.

Note that this modification will change the results when gdImageSetStyle()
or gdImageSetBrush() are used, but we believe that this modification is
also an improvement in this regard, even though it still might not make much
sense to use these functions with gdImageFilledArc().
2016-07-17 18:41:17 +02:00
Christoph M. Becker 9fd6021e12 Fix #252: gd_error() garbles variable arguments
Currently gd_error() forwards to gd_error_ex(). However, both functions
accept a variable number of arguments, and simply forwarding the va_list
isn't portable, see <http://c-faq.com/varargs/handoff.html>. This article
also describes the usual workaround, namely to let the second function
accept a va_list instead of variable number of arguments.

We do so by introducing a static helper, what does not affect API/ABI
compatibility.
2016-07-17 14:53:42 +02:00
Ondřej Surý ff0234f4da Proper fix for #248 2016-07-15 09:43:45 +02:00
Ondřej Surý 981060efd6 bug #248, fix Out-Of-Bounds Read in read_image_tga 2016-07-14 10:39:41 +02:00
Christoph M. Becker cb1a0b7e54 Unsupported TGA bpp/alphabit combinations should error gracefully
Currently, only 24bpp without alphabits and 32bpp with 8 alphabits are
really supported. All other combinations will be rejected with a warning.
2016-07-13 00:43:10 +02:00
Christoph M. Becker 076e0d19d7 Revert "Unsupported TGA bpp/alphabit combinations should error gracefully"
This reverts commit 10ef1dca63.

There are build errors, so we revert for now.
2016-07-12 22:09:13 +02:00
Christoph M. Becker 10ef1dca63 Unsupported TGA bpp/alphabit combinations should error gracefully
Currently, only 24bpp without alphabits and 32bpp with 8 alphabits are
really supported. All other combinations will be rejected with a warning.
2016-07-12 20:46:33 +02:00
Ondřej Surý ead349e998 Fix #247, A read out-of-bands was found in the parsing of TGA files (CVE-2016-6132) 2016-07-12 16:11:51 +02:00
Mike Frysinger 973cac8f3f Merge pull request #246 from khalidalqassabi/raqm
Add complex text layout support
2016-06-30 08:35:55 -04:00
Khalid Alqassabi 1dbccb737c Add complex text layout support
This pull request (based on Asma's works) adds support for languages that require [complex text
layout](https://en.wikipedia.org/wiki/Complex_text_layout).

We are using [libraqm](https://github.com/HOST-Oman/libraqm), a small source
code-only library that wraps FriBidi (for bidirectional text support) and
HarfBuzz (for text shaping), and does proper BiDi and script itemization.

The CTL support is enabled by default but can be disabled at compiling time,
and we provide a fallback function that uses your original code without CTL
support.
2016-06-30 13:19:25 +04:00
Pierre Joye a6a0e7feab fix php bug 72339 (CVE-2016-5766), Integer Overflow in _gd2GetHeader() resulting in heap overflow. Sync with php's sync 2016-06-29 09:36:26 +07:00
Pierre Joye aba3db8ba1 fix php bug 72339 (CVE-2016-5766), Integer Overflow in _gd2GetHeader() resulting in heap overflow 2016-06-28 16:23:42 +07:00
Pierre Joye a0f9f8f7bd fix php 72494, CID 149753, color is unsigned int, remove useless <0 comparison 2016-06-27 11:43:34 +07:00
Pierre Joye 1ccfe21e14 fix php 72494, invalid color index not handled, can lead to crash 2016-06-27 11:41:40 +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 7a661d2de6 update 2016-06-24 09:15:38 +07:00
Pierre Joye 81888a70b0 update 2016-06-24 09:13:12 +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 eafff87699 Merge branch 'GD-2.2'
* GD-2.2:
  fix CID 95837 duplicate code
  ensure null terminated string
  Fix #234: gdinterpolatedscale/gdTrivialResize is too slow
  ensure null terminated string
  Fix Coverity #95850: Structurally dead code
  Fix Coverity #102122: Unused value
  Fix Coverity #95850: Structurally dead code
  Fix Coverity #102122: Unused value
  Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
2016-06-21 12:17:46 +07:00
Pierre Joye f3b17253cb fix CID 95837 duplicate code 2016-06-21 12:17:26 +07:00
Pierre Joye 9f28c16ee0 ensure null terminated string 2016-06-21 10:40:06 +07:00
Pierre Joye 8757e32181 ensure null terminated string 2016-06-21 10:30:15 +07:00
Pierre Joye 292103e750 Merge branch 'master' of github.com:libgd/libgd 2016-06-21 10:21:01 +07:00
Christoph M. Becker cdbb81a07a Fix Coverity #95850: Structurally dead code
We slightly refactor the code to not use an else clause at all, what also
makes the code cleaner.

(cherry picked from commit 832c1ba791)
2016-06-21 00:28:36 +02:00
Christoph M. Becker 5eeb608db2 Fix Coverity #102122: Unused value
Apparently, that's a leftover from the "mode_mono fix from Giuliano Pochini".

(cherry picked from commit 327bf3d8b1)
2016-06-21 00:28:35 +02:00
Christoph M. Becker 832c1ba791 Fix Coverity #95850: Structurally dead code
We slightly refactor the code to not use an else clause at all, what also
makes the code cleaner.
2016-06-21 00:23:02 +02:00
Christoph M. Becker 327bf3d8b1 Fix Coverity #102122: Unused value
Apparently, that's a leftover from the "mode_mono fix from Giuliano Pochini".
2016-06-21 00:18:46 +02:00
Christoph M. Becker b331c55f58 Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
As reported in <https://bugs.php.net/64641> 1-dimensional horizontal
filled polygons are not drawn at all. That is caused by the scanline
algorithm used for drawing filled polygons which skips the drawing of
horizontal edges, because that is normally not necessary. If, however,
the polygon consists of horizontal edges only, that obviously doesn't
work, so we add a special case handling.

(cherry picked from commit f9f10fa9d4)
2016-06-20 14:43:03 +02:00
Christoph M. Becker f9f10fa9d4 Fix PHP bug #64641: imagefilledpolygon doesn't draw horizontal line
As reported in <https://bugs.php.net/64641> 1-dimensional horizontal
filled polygons are not drawn at all. That is caused by the scanline
algorithm used for drawing filled polygons which skips the drawing of
horizontal edges, because that is normally not necessary. If, however,
the polygon consists of horizontal edges only, that obviously doesn't
work, so we add a special case handling.
2016-06-20 14:16:23 +02:00
Pierre Joye d74f3521df Merge branch 'GD-2.2'
* GD-2.2:
  fix coverity 95857, given the underlying functions, risks to actually have a string overflow seems not possible. However this little safety check costs nothing and puts us on a 100% side.
2016-06-20 14:38:07 +07:00
Pierre Joye 6e72c35d81 fix coverity 95857, given the underlying functions, risks to actually have a string overflow seems not possible. However this little safety check costs nothing and puts us on a 100% side. 2016-06-20 14:37:38 +07:00
Pierre Joye a61d9f3600 Merge branch 'GD-2.2'
* GD-2.2:
  fix coverity CID 149461, check return value, return error
2016-06-20 10:09:54 +07:00
Pierre Joye 7c64cb9697 fix coverity CID 149461, check return value, return error 2016-06-20 10:09:35 +07:00
Pierre Joye cf6243fb5a Merge branch 'GD-2.2'
* GD-2.2:
  fix coverity CID 95855, missing break
  fix coverity CID 95865: bail out nicely on too long font name
2016-06-20 09:43:21 +07:00
Pierre Joye 9afd8c0737 fix coverity CID 95855, missing break 2016-06-20 09:42:16 +07:00
Pierre Joye 77055bc404 fix coverity CID 95865: bail out nicely on too long font name 2016-06-20 09:35:56 +07:00
Pierre Joye a01ebfaf86 Merge branch 'GD-2.2'
* GD-2.2:
  fix coverity CID 95841, should not happen but in case libpng adds special cases we will be covered here.
2016-06-20 09:20:00 +07:00
Pierre Joye 2b7c36d074 fix coverity CID 95841, should not happen but in case libpng adds special cases we will be covered here. 2016-06-20 09:19:17 +07:00
Pierre Joye 64a6371bd4 Merge branch 'GD-2.2'
* GD-2.2:
  fix covererity CID 95842, duplicate code
2016-06-20 09:13:10 +07:00
Pierre Joye bb4f6cca59 fix covererity CID 95842, duplicate code 2016-06-20 09:12:31 +07:00
Pierre Joye b6281cd6a9 Merge branch 'GD-2.2'
* GD-2.2:
  we need unsigned char storage here, not unsigned char *, aka allocate the right size
2016-06-19 16:00:02 +07:00
Pierre Joye bcc3d53a55 we need unsigned char storage here, not unsigned char *, aka allocate the right size 2016-06-19 15:59:43 +07:00
Pierre Joye ec74decf20 Merge branch 'GD-2.2'
* GD-2.2:
  let use unsigned here, the result is used as index anyway
2016-06-19 15:51:42 +07:00
Pierre Joye 78cd8a618d let use unsigned here, the result is used as index anyway 2016-06-19 15:51:21 +07:00
Pierre Joye 1e12a7eca0 Merge branch 'GD-2.2'
* GD-2.2:
  return if ctx creation failed
  clean up unused vars
  return if ctx creation failed
2016-06-19 15:41:13 +07:00
Pierre Joye 878569fd41 return if ctx creation failed 2016-06-19 15:40:53 +07:00
Pierre Joye 8fd40005ad return if ctx creation failed 2016-06-19 15:24:37 +07:00
Pierre Joye 85af454e89 Merge branch 'GD-2.2'
* GD-2.2:
  simplify, no need to allocate color here as it always true color
2016-06-19 15:17:57 +07:00
Pierre Joye bb09a211d3 simplify, no need to allocate color here as it always true color 2016-06-19 15:16:58 +07:00
Pierre Joye 132cadd4c0 Merge branch 'GD-2.2'
* GD-2.2:
  use unsigned int for index
  fix memory leak
  add email and quotes (just to be sure)
  use 2.2 for now
  add key for travis-coverity
  Fix 228: gdAssertImageEquals() can't be used

Conflicts:
	.travis.yml
2016-06-19 03:02:05 +07:00
Pierre Joye 489e90f7aa use unsigned int for index 2016-06-19 02:40:31 +07:00
Pierre Joye 75fb8f02ef fix memory leak 2016-06-19 02:33:02 +07:00
Christoph M. Becker 80ce084567 Fix #170: XBM images require width to be multiple of 8
We remove this limitation by fixing the underlying implementation bug,
and add a respective regression test to the suite.
2016-06-16 17:46:06 +02:00
Christoph M. Becker 0b9fe91679 Merge branch 'GD-2.2'
# resolved conflicts:
#	tests/gdimagerotate/bug00067.c
2016-06-15 17:55:38 +02:00
Christoph M. Becker c2b91dbce5 Fix #167: Styled thick horizontal lines are scrambled
Thick lines are drawn by gdImageFilledRectangle(), which iterates over
the x ordinate first (Z order) to apply the style pattern. While this works
fine for vertical and diagonal lines, it obviously fails for horizontal
lines, which have to be iterated over in N order.

To fix this bug, we introduce the helpers  gdImageFilled(H|V)Rectangle(),
which may be reused for other purposes as well.
2016-06-15 17:43:30 +02: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 910984af15 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:47:24 +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
Pierre Joye c90ab16521 Merge branch 'GD-2.2'
* GD-2.2:
  nuke unused variable
2016-06-12 14:31:48 +07:00
Pierre Joye 71f2fcda3e nuke unused variable 2016-06-12 14:31:27 +07:00
Pierre Joye a0ab07761e Merge branch 'GD-2.2'
* GD-2.2:
  fix #224 and fix #225 and overal quality are significantly improved, code much simpler as well
2016-06-12 13:41:17 +07:00
Pierre Joye 6267414dc2 fix #224 and fix #225 and overal quality are significantly improved, code much simpler as well 2016-06-12 13:40:15 +07:00
Pierre Joye b883831f1f Merge branch 'GD-2.2'
* GD-2.2:
  fix #223 pass coordiates as double to interpolated pixel, simplify edges and bg color checks and correct the calc of the delta between virtual pixels and pixels used for the interpolation. Summary: better quality
  gitignore: add missing entries #172 #218
  clean up new gdTransformAffineBoundingBox tests #221
2016-06-11 08:33:10 +07:00
Pierre Joye 2b26be874d fix #223 pass coordiates as double to interpolated pixel, simplify edges and bg color checks and correct the calc of the delta between virtual pixels and pixels used for the interpolation. Summary: better quality 2016-06-11 08:31:39 +07:00
Mike Frysinger 046290cd9e travis: update comments and add git status check
Want to make sure we don't forget to update .gitignore files!
2016-06-10 14:45:48 -04:00
Pierre Joye ba25cd0384 Merge branch 'GD-2.2'
* GD-2.2:
  fix #221 gdTransformAffineBoundingBox rounding error
2016-06-10 19:39:28 +07:00
Pierre Joye b30fdbf319 fix #221 gdTransformAffineBoundingBox rounding error 2016-06-10 19:38:39 +07:00
Pierre Joye 45f16d0769 Merge branch 'GD-2.2'
* GD-2.2:
  fix #172 single line rectangle creates wriclers. Simplify test.

Conflicts:
	tests/gdimagerectangle/github_bug_00172.c
2016-06-09 10:56:18 +07:00
Pierre Joye 19788a221a fix #172 single line rectangle creates wriclers. Simplify test. 2016-06-09 10:50:30 +07:00
Pierre Joye 8438ce5dd6 Merge branch 'GD-2.2'
* GD-2.2:
  fix #215, invalid color index, missing case for invalid border
2016-06-08 11:23:57 +07:00
Pierre Joye 6f5c4084c1 fix #215, invalid color index, missing case for invalid border 2016-06-08 11:23:38 +07:00
Pierre Joye 5bfcc2c7be Merge branch 'GD-2.2'
* GD-2.2:
  fix #218 zero width or height parameter can lead to crash
  prevent double definitions
2016-06-08 10:40:46 +07:00
Pierre Joye 77309c419c fix #218 zero width or height parameter can lead to crash 2016-06-08 10:39:27 +07:00
Pierre Joye e8bfada239 Merge branch 'GD-2.2'
* GD-2.2:
  fix #215 gdImageFillToBorder stack-overflow when invalid color is used
  tests: add bug_github_18 to gitignore #18
  tests: fix typo in test name #18
2016-06-04 23:14:57 +07:00
Pierre Joye 77f619d482 fix #215 gdImageFillToBorder stack-overflow when invalid color is used 2016-06-04 23:09:01 +07:00
Mike Frysinger adb05a4e40 ifdef out some unused pixel helpers
These don't seem to ever have been used, but since they follow API
patterns seen by other funcs in here, let's just #if 0 them out for
now.  This fixes unused func -Werror failures.
2016-06-03 20:37:05 -04:00
Pierre Joye fa82e9532e merge 2016-06-04 00:26:44 +07:00
Pierre Joye 7fad13a913 Fix #18 Poor maximum jpeg quality 2016-06-04 00:20:08 +07:00
Christoph M. Becker 5a85d6c3e3 gdImageRectangle: support any relative points
Contrary to gdImageFilledRectangle(), gdImageRectangle() has the
documented limitation that the given points have to be the upper
left and the lower right corner, respectively.  However, libgd
already caters to upper right / lower left pairs, and not
catering to the other two combinations seems to be an oversight.

Fixes #177.
2016-05-20 11:03:37 -04:00
Mike Frysinger a49ebbf1ed release gd-2.2.1 2016-05-20 10:39:04 -04:00
Ondřej Surý 4d29684fd4 CVE-2015-8874 2016-05-20 10:37:44 -04:00
Ondřej Surý 38241013cc CVE-2015-8874 2016-05-20 10:52:23 +02:00
Mike Frysinger a881959c02 master is now 2.3.0-dev 2016-05-19 22:50:13 -04:00
Mike Frysinger fe199edee5 release gd-2.2.0 2016-05-19 22:49:06 -04:00
Mike Frysinger c9a4a85f38 libimagequant: fix integration
The symbol was being set up in cmake but not on the autotools side.
Clean this up to be like other external libraries.

We need to pull in some openmp logic as it's not uncommon for the lib
to be built with openmp support.  When we test for it, we need to do
so with openmp flags.

Fixes #137.
2016-05-18 03:03:50 -04:00
Mike Frysinger b64c996b07 build: fix GDLIB_REVISION collision
We are using GDLIB_REVISION to refer to the gd version string (the "z"
in "x.y.z"), and we are using it to control the libtool revision field.
This leads to problems where the version increases (e.g. "2.1.1") but
the libtool revision doesn't (e.g. "0").  So scripts end up seeing a
revision of "0" in their output instead of "1".

Namespace the libtool version variables with "_LT_" to avoid any more
collisions.

Fixes #140.
2016-05-18 02:34:45 -04:00
Mike Frysinger 1239832a09 configure/cmake: unify header checks and config.h generation
Rather than hand maintain config.h.cmake (which is already out of date),
re-use the autogenerated config.h from autoheader.
2016-05-17 23:06:14 -04:00
Mike Frysinger 2733b623ee tga: cleanup/simplify a bit
Try to standardize the internals a little bit and simplify the read
paths to abort early on when we know we won't actually handle the
input format.  Avoid resetting pointers that are on the stack or we
release as it's a waste of code.
2016-05-14 03:51:26 -04:00
Mike Frysinger 96d5687689 tga: fix two memory corruption bugs #159
First, if the tga input had an ID set, we'd read this into the pointer
itself (and the memory after it in the struct/heap) instead of the memory
allocated to hold it.  This bug has been around since the tga code was
first added.  We'd basically corrupt memory all the time since most tga
files out there have an ID set up (like a datestamp).

Second, make sure we reject invalid images that would cause overflows in
the allocation path.  We tried to check for this already, but we used the
wrong type (we checked uint8_t but allocated int).

Fixes #159.
2016-05-14 03:45:42 -04:00
Mike Frysinger e5306635ff png: fix some memory leaks w/invalid images
The use of setjmp in this function was slightly incorrect: we store
pointers to allocated memory in stack variables, but we didn't call
setjmp again afterwards.  Optimization might place those in registers
which would clobber their values on the next longjmp.  Make sure we
call setjmp after every allocation to update the state.

As part of the cleanup, unify all the error code paths so we don't
have to worry about every if statement being fully correct.
2016-05-14 02:44:31 -04:00
Mike Frysinger 82b80dcb70 gif: avoid out-of-bound reads of masks array #209
When given invalid inputs, we might be fed the EOF marker before it is
actually the EOF.  The gif logic assumes once it sees the EOF marker,
there won't be any more data, so it leaves the cur_bits index possibly
negative.  So when we get more data, we underflow the masks array.

Flag it so we don't try to output anything more.  The image is invalid,
so we shouldn't be truncating any valid inputs.

This fixes #209.
2016-05-14 02:13:15 -04:00
Mike Frysinger 4dc1a2d793 xbm: avoid stack overflow (read) with large names #211
We use the name passed in to printf into a local stack buffer which is
limited to 4000 bytes.  So given a large enough value, lots of stack
data is leaked.  Rewrite the code to do simple memory copies with most
of the strings to avoid that issue, and only use stack buffer for small
numbers of constant size.

This closes #211.
2016-05-14 01:38:18 -04:00
Mike Frysinger b083ec17ad cmake: update build files to match autotools more
Clean up redundant header logic and focus on what we actually care about:
whether specific headers exist.

Update the program list to omit programs when required libs are not found.
2016-05-14 01:01:44 -04:00
Mike Frysinger 2db153a93e webpng: rewrite & cleanup to use getopt
The adhoc arg parsing is a pain to maintain.  Rewrite it all to use
getopt to make it much more simple and robust.
2016-05-14 00:17:12 -04:00
Mike Frysinger 75c38f6b32 fix various gcc/clang warnings found with -Wall 2016-05-13 22:19:26 -04:00
David Drysdale 4e61c9b021 tiff: fix leak in gdImageCreateFromTiffCtx()
The ephemeral tiff_handle used when interacting with libtiff needs
to be freed.
2016-05-01 01:44:02 -04:00
Mike Frysinger 658f168874 gd2: fix double free when processing invalid headers
This closes #208.
2016-04-30 21:55:17 -04:00
xicilion 09d2d01315 webp: fix double free
The filedata & temp pointers are assigned the same return value, so
trying to free both of them at the end makes no sense and results in
a double free error.  Drop one of them.
2016-04-30 21:31:02 -04:00
Mike Frysinger cd1d964179 libgd: update & sort cmake installed headers #164
The cmake side of things was missing two installed headers.
2016-04-30 21:12:51 -04:00
Mike Frysinger e16310b27c libgd: update & sort source lists
The Makefile.am has no changes other than sorting & unwrapping the files
to make it a bit more readable (and dropping duplicate entries).

The CMakeLists.txt gains a few files that were added recently but left
out of the cmake build.

Closes #183.
2016-04-30 21:00:31 -04:00
Remi Collet 982d4888a5 revert... unneeded 2016-04-27 08:23:09 +02:00
Remi Collet a5b5c2722d Fix memory leak
From:
http://git.php.net/?p=php-src.git;a=commitdiff;h=61c7a06e7c19d9b408db1129efa0959a0acbf0b1
2016-04-27 08:10:52 +02:00
Mike Frysinger 2bb97f407c gd2: handle corrupt images better (CVE-2016-3074)
Make sure we do some range checking on corrupted chunks.

Thanks to Hans Jerry Illikainen <hji@dyntopia.com> for indepth report
and reproducer information.  Made for easy test case writing :).
2016-04-16 03:51:22 -04:00
Matt Bosworth 4e53ed7992 Added support for reading and writing TIFFTAG_XRESOLUTION and
TIFFTAG_YRESOLUTION.  Includes a unit test.
2016-01-22 12:52:50 -08:00
Mike Frysinger 6913dd3cd2 bmp: use double variant of ceil func
We use ceill and ceil in this code, but it's not clear we need the long
double variant of ceill here.  The input multiply is already done with
double precision (the 0.1 literal is a double), and not all C libraries
offer long double variants.  Change to ceil and see if anyone notices.

Closes issue #123.
2016-01-11 00:02:05 -05:00
sherif-elmetainy e87ec88e1c :fix and unit test for crash issue in gdImageFillTiled 2016-01-09 23:02:12 +02:00
Mike Frysinger 73ab7c7d28 Merge pull request #182 from leoyanggit/fix_build_static
Make BUILD_SHARED_LIBS configurable
2015-12-23 11:59:17 -05:00
Mike Frysinger e08acb0565 Merge pull request #153 from davidchappelle/master
A few minor patches for libgd
2015-12-23 11:58:31 -05:00
Jitendar Kumar 78dad445b3 circletexttest: check image creation return value
In circletexttest.c, return value of gdImageCreateFromJpeg() and
gdImageCreateTrueColor() must be checked before dereferencing.
2015-12-23 11:54:33 -05:00
Peter Jas 8f69034043 code: Adds missing methods for absent libz case. 2015-11-24 05:27:37 +00:00
Peter Jas 2e04a67853 win: Use an external snprintf hook.
* For VS2013 and below, it will compile and additional file `src/snprintf.c`, which contains the fallback implementation. The
function is included with `extern` in other files where required.
* In `src/CMakeLists.txt`, `snprintf.c` is included in sources conditionally; only for
VS2013 and below.
* Note that I have also guarded it with condition inside the `snprintf.c` file, so if any consumer/downstream is not using `cmake` but their own build system (say gyp), this will still prevent them redefining snprintf for VS2015 even if they add `/src/snprintf.c` in to-be-compiled sources unconditionally.
2015-11-23 21:18:37 +00:00
Jitendar Kumar dd4828665c Logical Operation && has no Impact on expression result .
Line 1746:  second operand of  '&&' operator has no impact on expression result. 
It looks a typo mistake.
2015-11-09 07:28:25 +05:30
David Chappelle 9ea30979a4 Prevent duplicate macro definition errors/warnings
It is the responsibility of the build infrastructure or user to set or
not set NDEBUG. For the time being this is a workaround in the case
where NDEBUG is set by the build infrastructure or user which prevents
the compiler from generating macro redefiniton warnings/errors. A longer
term fix will require changes to booststrap (aka configure) as well as
cmake (aka CMakeLists.txt).
2015-08-27 14:29:19 -04:00
David Chappelle 40f42c0f75 Fix compiler warnings when checking interpolation_id
The interpolation_id is an enum that contains only positive
values. As a result, checking if it less than 0 generates a
compiler warning since the conditional check is always false.
2015-08-27 14:25:51 -04:00
Leo Yang 7147b646f4 Make BUILD_SHARED_LIBS configurable
As previously build both shared and static if BUILD_SHARED_LIBS is ON.
Otherwise build static only.
2015-08-27 13:11:37 -04:00
Vladimir Mitrovic 4751b606fa gdImageScaleTwoPass memory leak fix
Fixing memory leak in gdImageScaleTwoPass, as reported by @cmb69 and
confirmed by @vapier.  This bug actually bit me in production and I'm
very thankful that it was reported with an easy fix.

Fixes #173.
2015-08-05 03:01:06 +02:00
pierrejoye 4e1ce6609a Merge pull request #166 from jitendarKumar/patch-5
Dereference null return value in gdtest.c
2015-06-26 14:11:13 +07:00
pierrejoye 1219113c50 Merge pull request #155 from jitendarKumar/patch-2
Missing nullcheck in gd_topal.c
2015-06-26 14:10:22 +07:00
pierrejoye 38e016fc6c Merge pull request #156 from jitendarKumar/patch-3
Remove Deadcode in gd_nnquant.c
2015-06-26 14:09:31 +07:00
pierrejoye 4e701317ff Merge pull request #157 from jitendarKumar/patch-4
Remove Deadcode in gd.c
2015-06-26 14:07:50 +07:00
Jitendar Kumar 895be03d26 Indentation corrected.
Correcting Indentation in proposed patch as per review comment.
2015-06-03 18:14:22 +05:30
Jitendar Kumar 7b6261c04f Dereference null return value in gdtest.c
Return value of function which returns null is dereferenced without checking at multiple places.
2015-06-03 16:41:48 +05:30
Wangkun 917fa11bfb fix CMake error when ENABLE_WEBP 2015-05-07 17:48:37 +08:00
Wangkun 7ec030c4f1 add gdImageCreateFromWebpPtr impl 2015-05-07 17:48:05 +08:00
Jitendar Kumar eaca20f1e6 Remove Deadcode in gd.c
In API gdImageLine()

if `dx == 0` Checked and return else if `dy==0` Checked and return. 

if ((dx == 0) && (dy == 0))  never TRUE , code has no impact , can be removed.
2015-04-22 11:48:39 +05:30
Jitendar Kumar 312b020fa1 Update gd_topal.c
Update `*cimP`, before null checking `nim`.
return `FALSE` if `nim` is NULL, or else copy and destroy the image and return `TRUE`.
2015-04-22 11:24:15 +05:30
Mike Frysinger 18bbbfa8af Merge pull request #148 from smcdow/master
Fix segfault in gdImageFlipVertical() for non-TrueColor images.  Closes #148.
2015-04-22 01:39:28 -04:00
Jitendar Kumar f2712a6239 Remove Deadcode in gd_nnquant.c
File gd_nnquant.c : 
 
         #define initrad         (MAXNETSIZE>>3)                      // 256 >>3 = 32
         #define radiusbiasshift 6                               
         #define radiusbias      (((int) 1)<<radiusbiasshift)          // 1 << 6 = 64
         #define initradius      (initrad*radiusbias)                      // 32 * 64 = 2048 (fixed value) 

In API learn() 

        radius = initradius;                                           // initradius = 2048 
        rad = radius >> radiusbiasshift;                         // radiusbiasshift =6 which outputs radius >> 6 =32 
-       if (rad <= 1) rad = 0;                                         // rad <=1 always false. Code block has no impact. 
        for (i=0; i<rad; i++)
                nnq->radpower[i] = alpha*(((rad*rad - i*i)*radbias)/(rad*rad));
2015-04-22 10:58:33 +05:30
Jitendar Kumar 4cf53078a2 Missing nullcheck in gd_topal.c
Issue : gdImageNeuQuant() may possibly return NULL pointer.

nim can hold NULL value.

Should be NULL checked.
2015-04-22 10:17:56 +05:30
Jitendar Kumar d403501869 Dereference null return value in gdfx.c
Issue : gdImageSquareToCircle() may possibly return NULL pointer. 

im2 = gdImageCreateTrueColor (radius * 2, radius * 2);

im2 can hold NULL value when 0 returned. 

Should be NULL checked.
2015-04-22 09:46:58 +05:30
Mike Frysinger ac527e646e delete webpimg.c references
This code was purged w/libvpx recently.
2015-04-11 16:25:49 -04:00
Stuart McDow c9dac2d941 Fix segfault in gdImageFlipVertical() for non-TrueColor images. 2015-04-03 11:00:22 -05:00
Daniel Melani 4e833d3aea Added missing zero. 2015-03-26 20:21:11 +01:00
Pierre Joye 88fb8fc460 typo 2015-01-20 09:49:00 +01:00
Pierre Joye 4ef590371c fix some leaks on error 2015-01-20 09:16:49 +01:00
Pierre Joye 824a3aaa37 remove remaining libvpx related code 2015-01-20 07:06:09 +01:00
Pierre Joye a79232c5fa fix #129, drop VPX usage in favor of libwebp 2015-01-20 04:55:11 +01:00
Pierre Joye 9a205a1e3f Merge branch 'GD-2.1' 2015-01-20 02:20:13 +01:00
Pierre Joye 511160e8ba fix #82, fix 1 bit tiff support 2015-01-20 02:19:54 +01:00
Pierre Joye 7a567dba5f Merge branch 'GD-2.1' 2015-01-20 01:57:46 +01:00
Pierre Joye aa1d71c34c fix #135, fix logic in gdkanji 2015-01-20 01:57:13 +01:00
Remi Collet 255a9e4129 fix visibility test 2015-01-19 07:27:27 +01:00
Pierre Joye f680978aa8 fix #94, HAVE_VISIBILITY may be defined but set to 0 2015-01-19 06:35:20 +01:00
Pierre Joye b126726525 fix #89, fix leaks on tiff read 2015-01-19 05:49:52 +01:00
Pierre Joye acdebc8148 fix #84, double free and overrun due to wrong alloc type, uint8_t instead of int 2015-01-19 05:40:53 +01:00
Pierre Joye 490bc3e0b9 free palette on error 2015-01-19 04:10:46 +01:00
Pierre Joye 289c82929f port fix for saner boolean usage from https://reviews.facebook.net/D31695 2015-01-17 09:10:31 +01:00
Pierre Joye 2b3130efe6 fix #90, actually copy src to dst 2015-01-17 08:34:07 +01:00
Pierre Joye c7e5dc617c fix #111, invalid default quantization 2015-01-17 08:20:17 +01:00
Pierre Joye 81d341c8f1 fix #113, NULL deref in gdfx 2015-01-17 07:28:46 +01:00
Pierre Joye 2f40d52ddc Fix #138, VS 2010 build error due to double semi column 2015-01-15 11:05:43 +01:00
Pierre Joye 0e9c4e005d master is now 2.2.0-dev 2015-01-15 02:28:23 +01:00
Pierre Joye 06b2e4f32f back to dev 2015-01-15 01:18:07 +01:00
Pierre Joye d39f7231d5 prep release 2015-01-14 04:06:45 +01:00
Pierre Joye be907e0582 fix indent 2015-01-14 02:30:38 +01:00
Pierre Joye 1424dd6c1a free path on error 2015-01-14 02:11:08 +01:00
Pierre Joye 13d87a623e free im on error 2015-01-14 02:09:30 +01:00
Nathanael Jones 032431602d Remove uneeded includes introduced in earlier version-local commits. 2015-01-07 02:09:31 -05:00
Nathanael Jones 4d54513072 Exposed all missing format-independent members in the C++ wrapper.
Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
Rebased by Nathanael Jones
2015-01-07 02:03:11 -05:00
Nathanael Jones c7bf3794b6 Update gdpp.* to use HAVE_LIBPNG vs HAVE_PNG, etc.- should honor the same feature support flags as the rest of gd, 2015-01-07 02:01:53 -05:00
Nathanael Jones 40c6129986 Normalize static lib name to libgd.a on *nix and libgd_static.lib on windows. 2015-01-07 01:55:53 -05:00
Nathanael Jones f085a2e59d When both CPP_SHARP and _WIN32 are defined, do not enable thread safety. 2015-01-07 01:39:10 -05:00
Nathanael Jones e81ff9051b Export C++ wrapper clases. Change two Gd() functions of the C++ wrapper to return values when the underlying C calls do. 2015-01-07 01:39:10 -05:00
Pierre Joye e8a1a4699a free coeffs 2015-01-07 06:32:19 +01:00
Pierre Joye 5f7c099fc8 free allocated palette on error 2015-01-07 06:27:11 +01:00
Pierre Joye 7b4986279a fix im leaked on error 2015-01-07 06:17:51 +01:00
Pierre Joye 4faf926d3f just reduce static analyzer noise 2015-01-07 06:13:53 +01:00
Pierre Joye 2a09086c02 free tc_cache and path on error (leak) 2015-01-07 06:10:36 +01:00
Remi Collet 4af76c97a4 fix comment 2015-01-02 09:18:27 +01:00
Remi Collet 3c0d2203b2 Fix possible infinite loop (php bug report #68713)
- make code more legible (yy>=yy-1 seems ugly)
- fix mem leak, always free src->tpixels
2015-01-02 09:09:22 +01:00
Remi Collet 81e9a993f2 move overflow test outside the loop for perf 2014-12-16 18:29:47 +01:00
Remi Collet 47eb44b2e9 Fix possible buffer read overflow
detected by -fsanitize=address, thanks to Jan Bee
2014-12-13 08:48:18 +01:00
Nathanael Jones 7eb9462c5b Merged in nathanaeljones/gd-libgd/cmake-iconv (pull request #24)
Add libiconv support to CMake files
2014-10-17 10:59:56 -04:00
Nathanael Jones ade007da11 Support MSVC++ 2013 and higher: define _ALLOW_KEYWORD_MACROS, inline, strcasecmp, snprintf. 2014-10-02 16:51:05 -04:00
Nathanael Jones f82b371418 Add libiconv support to CMake files 2014-10-02 14:59:29 -04:00
Nathanael Jones 08eb6ee8e9 Restore support for alphaBlendingFlag value gdEffectAlphaBlend 2014-09-03 22:11:29 +00:00
Ondřej Surý 31ff666946 Merged in ttoohey/gd-libgd/layout-effect (pull request #18)
Overlay and multiply effects for gdImageSetPixel
2014-08-04 11:05:04 +02:00
Ondřej Surý 33c05c1e6f Merged in ttoohey/gd-libgd/bugfix/font_path_overrun (pull request #19)
Fix buffer overrun from long font search path
2014-08-04 11:04:48 +02:00
Remi Collet 463c3bd09b CVE-2014-2497, NULL pointer dereference, fix #126 2014-08-04 10:31:25 +02:00
Pierre Joye f01ade71b9 Remove wrong license headers. Based on http://www.paulbourke.net/dataformats/tga/ 2014-05-21 10:44:03 +00:00
Tim Toohey 354409b80c Fix buffer overrun from long font search path
MAXPATHLEN is set to 256 (on some systems), and DEFAULT_FONTPATH is longer
than this (on some systems). The sprintf() to path[MAXPATHLEN] thus
resulted in a buffer overrun when in some circumstances (also,
fontsearchpath is in the control of the environment, so this could be
triggered on any platform).
2014-04-24 17:35:09 +10:00
Tim Toohey b39f92b195 Add overlay and multiply effects to gdImageSetPixel 2014-04-23 10:48:57 +10:00
Remi Collet 4b86e06937 Fix artefact in gdImageScale using GD_BILINEAR_FIXED
See https://bugs.php.net/66887 for sample image
and examples/resize.c to test.
2014-03-12 17:03:24 +01:00
Remi Collet 5b42b1178c Fix gdImageSetInterpolationMethod with GD_DEFAULT
As we have "im->interpolation_id = id;" after the switch
2014-03-12 15:26:40 +01:00
Chris Reuter 0cb34fdb31 Got gd_filename.c to work correctly under Windows.
Specified calling convention on function pointers.  (This matters
under Windows).

Switched from rindex() to strrchr() (oops!).

Tidied the formatting a bit.
2014-02-07 14:17:17 -05:00
Chris Reuter 275ac17bcc Started importing the old manual into Naturaldocs comments.
This changeset imports documention for gdImage to gdImagePng*() into
Natural Docs.  Documention is based on the text of the original
manual, version 2.0.36 but adapted to better suit the format.
Subsequent changesets will introduce docs for subsequent manual
entries.

naturaldocs, when present, is invoked by bootstrap.sh.  The completed
manual will be in docs/naturaldocs/html/index.html.  It can also be
explicitly invoked by running docs/naturaldocs/run_docs.sh.

This change also removed docs/naturaldocs/project/Menu.txt, since it
currently contains no non-generated content and is prone to introduce
noise into the changeset.
2014-01-07 15:29:06 -05:00
Chris Reuter 3b2caf62b9 Added function 'gdImageGetInterpolationMethod()'.
This retrieves the interpolation method set via
gdImageSetInterpolationMethod().  It is a function instead of a macro
for the benefit of VMs that need a function pointer to call.
2014-01-07 15:19:39 -05:00
Chris Reuter c9d2f89597 Added gdImageFile(), gdImageCreateFromFile() and gdSupportsFileType().
These are convenience functions which load or save image data to a
file.  They are roughly equivalent to opening a file handle with
fopen() and calling gdImageCreateFrom*() or gdImage*() on the FILE
pointer.  However, these functions identify the input or output format
from the filename suffix and call the appropriate read or write
function accordingly.

gdSupportsFileType() can be used to test if a specific file format
is supported.

Most scripting interfaces already do something like this but now
there's support for doing it from C as well.

This change also adds test cases for the code and naturaldocs
documentation.
2013-12-16 17:27:34 -05:00
Chris Reuter e054be7d82 Small code cleanup.
Removed non-exported prototypes from gd.h.  Where possible, made the
functions static and moved the rest of the prototypes to gd_intern.h.

Also removed redundant macros MIN/MAX macros from gd_interpolation.c
(since they're also defined in gd_intern.h) and tidied the formatting
a little.
2013-12-11 18:02:37 -05:00
Chris Reuter 6febd903b6 Added a new Gaussian blur function.
gdImageCopyGaussianBlurred() returns a blurred copy of its argument.
Blurring is done in two passes to take advantage of the Gaussian
function's separability for.  This makes the algorithm much faster
than single-pass implementations, especially for larger radii.

This change also adds documentation for the new function and the
existing blur (gdImageGaussianBlur()).
2013-12-10 19:17:28 -05:00
Chris Reuter d525680527 Bug fix: gdImageScale() was sometimes messing up transparency.
_gdScaleOneAxis() was clamping the alpha channel to 0..255 when it
should be clamping it to 0..127.  This sometimes caused artifacts.

This change fixes that.
2013-11-19 15:08:55 -05:00
Chris Reuter bb1d4a044e Added documention for gdImageCreate() and type gdImage.
This change adds naturaldoc comments for the above function and type.
Text was adapted from the 2.0.36 manual.

It also fixes the formatting of the comment for gdInterpolationMethod
so that naturaldoc will extract it.
2013-11-18 18:21:28 -05:00
Chris Reuter e82b084159 Added new files to CMakeLists.txt.
Added new sources and tests to the relevant CMakeLists.txt files.

NOTE: This works for me but I am not a cmake expert.
2013-11-07 19:44:45 -05:00
Chris Reuter 4378b8ded4 gd.h now holds the canonical version number.
Up to now, the version numbers were defined in configure.ac and put
into gd.h by generating it from gd.h.in, replacing the values of
several C macros.  This violates the DRY principle, won't work on a
dumb build system, confuses some dev tools and is just a huge headache
in general.

This change makes gd.h (no longer generated) the home of the version
number and provides a script (config/getver.pl) which can extract the
requested version components from the header file.  configure.ac now
gets the version number from gd.h instead of vice versa.

In addition, there are now C functions that return the values of the
version macros.  This is for the benefit of non-C code using the
library without access to the header file.  It also provides a way to
get the version number of the library currently linked rather than the
header the program was compiled against.  (This could change if the
shared library is updated without recompiling the program using it.)
2013-11-07 19:44:45 -05:00
Chris Reuter 3884557700 Merged in suetanvil/gd-libgd/scale-palette-image-bug (pull request #16)
Fix for #97
2013-10-23 12:40:25 -04:00
Chris Reuter 723ea520be Fix for Issue #97: segfaults when scaling a non-truecolor image
gdImageScaleTwoPass() now converts palette sources to truecolor before
scaling.  This is consistent with the behaviour of the other scale
functions.
2013-10-22 21:22:35 -04:00
Chris Reuter 948bb0a5c2 Higher precision in scaling.
Scaling (i.e. _gdScaleOneAxis()) used to accumulate the weighted
samples in unsigned char variables.  This truncated the floating-point
result toward zero, leading to a darker image and quantization of
colour gradients.

This change switches to keeping the values in doubles and only
coverting the final sums to unsigned char.  In addition to producing a
better result, it is also about 10-15% faster.

The conversion uses a couple of casts for speed.  The behaviour is
defined by ANSI but only correct on computers using twos-complement
arithmetic.  As such, this may break on obscure microcontrollers or
1960's-era minicomputers.
2013-10-15 18:01:05 -04:00
Pierre Joye 916d00c2f0 Merged in suetanvil/gd-libgd/suetanvil-scale-code-cleanup (pull request #14)
Major cleanup of FP scaling code
2013-10-10 08:15:30 +02:00
Chris Reuter 546b274f27 Bug fix: #92: Bicubic scaling leaves the rightmost and bottom rows black
This turns out to be a simple off-by-one error.

Issue URL: https://bitbucket.org/libgd/gd-libgd/issue/92/bicubic-scaling-leaves-the-rightmost-and
2013-10-09 21:29:06 -04:00
Chris Reuter be3c8cbbc0 Cleaned up floating-point rescaling code.
These changes improve readability without negatively affecting
correctness or performance.

1) The code to do horizontal and vertical scaling were mostly
identical.  This change merges them.

2) The case where the original and result sizes were identical were
handled inefficiently (and probably incorrectly) by copying the source
to the destination with memcpy.  This change makes a simple copy if
both dimensions are the same (i.e. no resizing is requested) and skips
resizing in the unchanged dimension if only one dimension is
different.

3) Other cleanups: removed dead code, improved variable names, added
assertions to document expections, etc.
2013-10-09 21:24:35 -04:00
Chris Reuter 0d13658b84 More dead code removal.
Missed the typedef.  This patch gets it.
2013-09-27 17:57:14 -04:00
Chris Reuter 5ce14ef47a Removed some dead code.
Removed an unused enum type from gd_interpolation.c. This was the
original version of gdInterpolationMethod in gd.h.
2013-09-27 17:45:51 -04:00
Chris Reuter 4f65a3e4ee Fixed memory overrun bug in gdImageScaleTwoPass
_gdContributionsCalc would compute a window size and then adjust
the left and right positions of the window to make a window within
that size.  However, it was storing the values in the struct *before*
it made the adjustment.  This change fixes that.
2013-09-23 18:03:08 -04:00
Chris Reuter 4c70f57fd9 Fix #86: gdImageScale segfaults with most interpolation types
Code fails to propagate the interpolation type to an intermediate
temp image.  This change fixes that.
2013-08-27 21:15:56 -04:00
Ondřej Surý 54f80199e1 GD_EXTRA_VERSION and GD_VERSION_STRING needs quotes (Courtesy of Marc Deslauriers) 2013-06-28 15:42:22 +02:00
Ondřej Surý f47a1df550 Create gd.h from gd.h.in to properly include current library version 2013-06-26 17:09:02 +02:00
Remi Collet 648fdb56de seems simpler... 2013-06-22 09:47:55 +02:00
Remi Collet 98c3fde35c use 4k for allocation step 2013-06-22 09:40:06 +02:00
Remi Collet 6f3c478c35 improves a08a17ddaf 2013-06-22 09:34:30 +02:00
Remi Collet a08a17ddaf gdImageCreateFromWebpCtx new implementation proposal, fix issue #75 2013-06-22 09:23:57 +02:00
Ondřej Surý 011cdd1457 Add msinttypes/ folder to EXTRA_DIST (fixes #73) 2013-06-22 08:36:46 +02:00
Ondřej Surý 373e495aa6 Revert "Get rid of msinttypes folder and replace it with compile error if fixed-width integers are not available (fixes #73)"
This reverts commit 4feac0a10e.
2013-06-22 08:35:04 +02:00
Ondřej Surý 4feac0a10e Get rid of msinttypes folder and replace it with compile error if fixed-width integers are not available (fixes #73) 2013-06-22 08:00:07 +02:00
Pierre Joye 725ba9de40 Merge branch 'master' of https://bitbucket.org/libgd/gd-libgd 2013-06-10 14:54:17 +02:00
Pierre Joye 84d2371b78 fix #70 2013-06-10 14:53:45 +02:00
Remi Collet 837b73276d fix integer overflow in AAline, fixed issue #5 2013-06-10 10:15:18 +02:00
Remi Collet eca37d620a fix hangs in gdImageAALine (bug int overflow can still occur, need improvment 2013-06-10 09:30:29 +02:00
Remi Collet da6c203bb3 fix palette copy in gdimageclone 2013-06-10 08:49:31 +02:00
Pierre Joye 87eb546a65 we need to define inline 2013-06-10 08:39:38 +02:00
Pierre Joye e8bbc9274a fix build, const is just as good here too 2013-06-10 08:38:01 +02:00