Commit Graph

91 Commits (767699b9f4911ee5cd488c035cb4c1033ef5cf40)

Author SHA1 Message Date
Pierre Joye 767699b9f4 Fix #808, When RAQM is used, and it fails or no text processed, the glyph may be leaked 2022-01-30 09:33:07 +07:00
Pierre Joye 6bbeba447b
Fix #808, When RAQM is used, and it fails or no text processed, the glyph may be leaked (#809) 2022-01-29 21:03:29 +07:00
Mike Frysinger d6baf4c5c9 gdft: fix image pointer types
These are equiv, but switch them over for clarity & consistency.
2021-05-26 20:12:50 -04:00
Mike Frysinger b4eb70cf74 drop support for freetype <2.1.3
The configure script has already been requiring freetype-2.1.10+, so
this isn't really dropping old support.  Even then, 2.1.3 was released
in 2002, so users have had plenty of time to upgrade.
2021-04-24 23:27:45 -04:00
Remi Collet 0be6aec0fe Fix #615 using libraqm
and avoid unneeded free
2020-07-15 09:45:07 +02:00
Christoph M. Becker 3dd0e308cb
Fix #615: gdImageStringFT() fails for empty strings as of libgd 2.3.0 (#633)
We change the return type of `textLayout()` to `ssize_t`, and signal
failure by returning `-1`, so that laying out an empty string is no
longer handled as failure.  We make sure that no overflow occurs,
assuming that all `int` values can be fully represented as `ssize_t`.
2020-05-05 18:02:45 +08:00
wilson chen 04bb9a08b3
Fix #301: brect bounds
According to the result, the extra one pixel is unnessary. Deleting the related code block makes
the image looks fine.
2020-02-25 23:40:27 +08:00
Peter Kokot 434b639d53 Add leading blank lines check and trim redundant blank newlines 2018-10-05 10:27:50 -04:00
Mike Frysinger e6bb110663 drop netware support #294
We have no way of testing netware, and the OS has been dead for years.
PHP also has dropped support for it.

Closes #294.
2018-08-25 12:50:23 -04:00
Mike Frysinger 748578ff3f gdft: change strncpy usage to memcpy
All the uses of strncpy in here are based on strlen of the input, so
there's no need to run through an str-based func again.  Switch to a
straight memcpy.  Plus this avoids static checkers that blindly choke
on strncpy.  The code was already adding a trailing NUL byte, so that
isn't problematic either.
2018-06-22 00:09:50 -04: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 5176856eae Fix potential memory leak in gdImageStringFTEx()
Of course, we have to free all allocated resources before returning.

Reported by shqking <shqking@gmail.com> to security@libgd.org.
2017-08-29 16:47:24 +02:00
Galik 3385b9aebf Truetype font drawing functions now take `const` strings (#400)
The following API functions now accept the font names and the text to be
printed as `const char*` rater than `char*`. This makes the functions
much more `C++` friendly.

gdImageStringFT();
gdImageStringTTF();
gdImageStringFTEx();

Other functions/types affected:

typeed struct fontkey_t;

any2eucjp();
gdTcl_UtfToUniChar();
DetectKanjiCode();
do_convert();
do_check_and_conv();
2017-07-29 11:24:32 -04:00
Christoph M. Becker b95197edee Fix fontlist doc 2016-09-04 18:45:46 +02:00
Christoph M. Becker 0bd7ec0560 Fix use-after-free vulnerability
Of course, we must not free `text` before we're finished with it.

As this issue affects master only, it is not a security issue.
2016-08-27 16:08:38 +02:00
Christoph M. Becker 59d077aeab Fix build failure for --without-fontconfig
If fontconfig support is disabled, the static functions font_pattern() and
useFontConfig() are never used. This can lead to build errors, and does so
with the current default settings `-Wall -Werror`. Therefore we ensure that
these functions are not compiled when they are not needed.
2016-08-27 11:49:40 +02:00
Christoph M. Becker c1804def24 Mark up code examples with (start|end code)
This makes the code better readable in the sources, and we get syntax
highlighting in the generated HTML wherever we want it (i.e. not necessarily
always as with `-hl all`).
2016-08-23 22:27:27 +02:00
Christoph M. Becker 4778a8a946 Document gdft.c and gdfx.c
We also remove the respective comments from the *private* gdfx.h.
2016-08-23 21:35:32 +02:00
Mike Frysinger b7a01fe6e3 gdft: fix build when freetype is disabled
In file included from gdft.c:20:0:
entities.h:17:4: error: 'entities' defined but not used [-Werror=unused-variable]

gdft.c:1741:15: error: 'font_path' defined but not used [-Werror=unused-function]
 static char * font_path(char **fontpath, char *name_list)
2016-08-10 13:35:08 +08: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
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
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
Pierre Joye 1424dd6c1a free path on error 2015-01-14 02:11:08 +01:00
Pierre Joye 2a09086c02 free tc_cache and path on error (leak) 2015-01-07 06:10:36 +01: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
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
Colin Watson 73bb3e9619 Add missing pointer dereference in font_pattern 2013-06-02 10:12:59 +02:00
Ondřej Surý f0ddf2eccd Introduce gdReallocEx which will free the original memory when realloc
fails to circumvent lost memory when doing:

    a = gdRealloc(a, s);
    if (!a)
        return;

Thanks to Niels Thykier for catching that.
2013-05-20 21:10:28 +02:00
Ondřej Surý 525ff7480b Fix memory leak in gdft.c (Courtesy of Niels Thykier) 2013-05-20 20:32:18 +02:00
Remi Collet 20015feb2d fonpath is char ** 2013-04-26 07:45:16 +02:00
Ondřej Surý 0b345cfadc Remove MAX and MIN now provided by gd_intern.h, and use MAXPATHLEN instead of MAX_PATH 2013-04-25 12:13:55 +02:00
Pierre Joye 34973ce3dd fixes #51 and get rid of strdup, strncpy instead 2013-04-25 12:09:14 +02:00
Pierre Joye 6bdf2165ce portable max path len 2013-04-25 10:02:38 +02:00
Pierre Joye b34c4a20f0 no need to strdup path, max_path can be used, some safety around fontlist free 2013-04-24 12:23:03 +02:00
Ondřej Surý c60d9fe577 Unify the Win32 check to _WIN32 check which is defined by both VC and MinGW 2013-04-23 06:03:59 +02:00
Pierre Joye 364a10a282 #45, fix gdImageStringFT and other functions in gdft.c not being exposed correctly. Include config.h 1st helps :) 2013-04-21 15:48:59 +02:00
Pierre Joye 1976a5c2f5 fix conflict 2013-04-21 00:17:02 +02:00
Pierre Joye c8cce62352 -fix build when fontconfig is not enabled 2013-04-18 22:56:45 +02:00
Ondřej Surý 32b1307c62 Use custom error handler instead of fprintf(stderr, ...) 2013-04-18 08:28:36 +02:00
Takeshi Abe aeb7fed08e suppress -Wunused-variable 2013-04-11 19:05:04 +09:00
Ondřej Surý 15ea6bc5a1 Fix several uninitialized variable reads, dereferences before NULL checks, resource leaks and some other minor errors 2013-04-08 12:53:52 +02:00
Marcin Wojdyr 2a921c80fb set default values for DEFAULT_FONTPATH and PATHSEPARATOR for Windows
(merged and expanded settings from gd.h and gdft.c)

--HG--
branch : default_fontpath
2013-04-06 17:37:28 +01:00
pierrejoye e20413bf6b - apply same CS everywhere 2013-04-03 14:23:11 +02:00
Takeshi Abe 7382faef3c fix -Wsign-compare 2013-02-15 15:39:38 +09:00
tabe ce46d92674 fix -Wunused-parameter 2013-02-12 13:47:20 +09:00
tabe 3aaf1ab557 fix -Wunused-parameter 2013-02-11 11:31:40 +09:00
tabe 04bcbd544d cacheFetch & gdCacheGet can fails 2011-01-20 13:48:40 +09:00
tabe 4d808f89a7 Fixed a possible memory leak in case that FT_Glyph_To_Bitmap() fails 2009-11-01 14:16:26 +09:00
tabe 80030df996 removed unused assignment to fontpath 2009-04-20 08:58:14 +00:00