Commit graph

44 commits

Author SHA1 Message Date
shubham shrivastav
897213f36b Insufficient memory for terminating null of string in _XcursorThemeInherits
Fix does one byte of memory allocation for null termination of string.
https://bugs.freedesktop.org/show_bug.cgi?id=90857

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-06-05 13:36:22 -07:00
Alan Coopersmith
edf52212a0 Fix some clang integer sign/size mismatch warnings
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-10-18 10:52:49 -07:00
Alan Coopersmith
bbf3c582c9 Use strdup() instead of malloc(strlen())+strcpy()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-10-18 10:24:13 -07:00
Alan Coopersmith
8f677eaea0 signedness bug & integer overflow in _XcursorFileHeaderCreate() [CVE-2013-2003]
When parsing cursor files, a user defined (e.g. through environment
variables) cursor file is opened and parsed.

The header is read in _XcursorReadFileHeader(), which reads an unsigned
int for the number of toc structures in the header, but it was being
passed to _XcursorFileHeaderCreate() as a signed int to allocate those
structures.  If the number was negative, it would pass the bounds check
and could overflow the calculation for how much memory to allocate to
store the data being read, leading to overflowing the buffer with the
data read from the user controlled file.

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-04-26 17:22:43 -07:00
Alan Coopersmith
1b98fd6a2e Replace deprecated Automake INCLUDES variable with AM_CPPFLAGS
Excerpt https://lists.gnu.org/archive/html/automake/2012-12/msg00038.html

  - Support for the long-deprecated INCLUDES variable will be removed
    altogether in Automake 1.14.  The AM_CPPFLAGS variable should be
    used instead.

This variable was deprecated in Automake releases prior to 1.10, which is
the current minimum level required to build X.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-01-15 18:51:39 -08:00
Alan Coopersmith
8229cf75b3 XcursorImageLoadCursor: return failure if _XcursorGetDisplayInfo fails
Error: Null pointer dereference (CWE 476)
   Read from null pointer 'info'
        at line 615 of src/cursor.c in function 'XcursorImageLoadCursor'.
          Function '_XcursorGetDisplayInfo' may return constant 'NULL' at line 134, called at line 597.
          Null pointer introduced at line 134 of src/display.c in function '_XcursorGetDisplayInfo'.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-30 18:59:43 -08:00
Alan Coopersmith
2b8d373bdd XcursorFileSaveImages: plug memory leak on invalid input
Error: Memory leak (CWE 401)
   Memory leak of pointer 'comments' allocated with XcursorCommentsCreate(0)
        at line 982 of src/file.c in function 'XcursorFileSaveImages'.
          'comments' allocated at line 978 with XcursorCommentsCreate(0).
          comments leaks when comments != 0 at line 981.

[ This bug was found by the Parfait 0.3.7 bug checking tool.
  For more information see http://labs.oracle.com/projects/parfait/ ]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-30 18:59:33 -08:00
Jon TURNEY
862b9ce4aa Fix install of generated Xcursor.h when builddir != srcdir
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by:  Gaetan Nadon <memsize@videotron.ca>
Tested-by: Gaetan Nadon <memsize@videotron.ca>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-25 13:15:30 +01:00
Alan Coopersmith
e086eb1bf4 Strip trailing whitespace
Performed with: find * -type f | xargs perl -i -p -e 's{\s+$}{\n}'
git diff -w & git diff -b show no diffs from this change

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-16 21:26:17 -07:00
Alan Coopersmith
4ce23fcd97 Mark bitmasks as unsigned ints
Clears Sun compiler warnings from shifting 8 bits by 24 bits:
"cursor.c", line 215: warning: integer overflow detected: op "<<"
"cursor.c", line 280: warning: integer overflow detected: op "<<"

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-05-22 12:55:31 -07:00
Jeremy Huddleston
047993c76a Correct error handling in _XcursorAverageColor
Previously it would either div-zero or get stuck in a loop until int overflow
if called with a bad value.

cursor.c:214:32: warning: Division by zero
    return (0xff << 24) | ((red/npixels) << 16) | ((green/npixels) << 8) | (blue/npixels);

Found-by: clang static analyzer
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-05-07 10:16:18 -07:00
Chris Wilson
bee68e54e5 Free the FontInfo structure after loading the cursor from it.
References: https://bugs.freedesktop.org/show_bug.cgi?id=2731
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Chris Wilson
f49e7e1608 Free the partial header after failing to open the cursor.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Chris Wilson
073eb2c56f Free list on shutdown.
We freed the parent structure without freeing the list contained within,
making valgrind unhappy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-04-01 12:16:56 +01:00
Gaetan Nadon
a3e03bb23b config: move CWARNFLAGS from configure.ac to Makefile.am
Compiler warning flags should be explicitly set in the makefile
rather than being merged with other packages compiler flags.

Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-02-16 10:37:21 -05:00
Paulo Cesar Pereira de Andrade
f00ae32322 Janitor: make distcheck, compiler warnings, extra .gitignore files. 2009-01-29 15:34:11 -02:00
Matthieu Herrb
04641d3cc3 nuke RCS Ids 2008-03-09 00:34:36 +01:00
Tilman Sauerbeck
3c5d4f591c Store the cursor names in one large string.
This means the compiler doesn't need to place the array in the
read-write sections of the DSO, which means less relocations
when the library is loaded and a smaller memory footprint.
2007-05-12 22:41:27 +02:00
Alan Coopersmith
9df9640643 Fix many sparse warnings: Using plain integer as NULL pointer 2006-10-10 14:57:16 -07:00
Alan Coopersmith
b6b9f58855 Fix lint warning: deallocating a pointer that could be NULL: library.c(266) 2006-10-10 13:46:17 -07:00
Alan Coopersmith
d0e12a9784 Add XORG_WITH_LINT to allow checking code with lint/sparse/etc. 2006-10-10 13:33:33 -07:00
Chris Wilson
e0a501e91c fix leak in header destruction
Fix a couple of if (!foo) free(foo); tests.
2006-08-12 19:55:44 +03:00
Alan Coopersmith
2f08984396 renamed: .cvsignore -> .gitignore 2006-07-13 14:58:50 -07:00
Daniel Stone
c6f65af419 Bug #5268: Fix small memory leak. (Matthias Clasen). Change some return 0s
to NULL. Bump to 1.1.7.
2006-06-03 10:23:57 +00:00
Adam Jackson
f9bc007d71 Coverity #159: Prevent a possible NULL chase. 2006-04-07 00:58:59 +00:00
Kevin E Martin
189c967226 Add configure options to allow hard-coded paths to be changed. 2005-12-08 17:55:19 +00:00
Kevin E Martin
b8c92a26d0 Allow hard-coded paths to be configurable. 2005-12-08 17:54:40 +00:00
Adam Jackson
7c7bdccde9 Bug #4244: Make XcursorSetTheme(dpy, NULL) restore the default theme.
(Frederico Mena-Quintero)
2005-10-19 22:26:55 +00:00
Adam Jackson
7a5e360179 Do PKG_CHECK_MODULES on a unique token instead of on "DEP", so builds with
a global configure cache don't get confused.
2005-08-03 03:28:01 +00:00
Daniel Stone
b34368c667 Change soversion to 1.0.2 with -version-number. 2005-07-16 06:35:32 +00:00
Keith Packard
9ffefcd641 Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory 2005-07-09 06:13:36 +00:00
Keith Packard
b5a724c201 Make sure XFIXES appears in LIBS line, fix up other pkg-config usage. 2005-07-08 05:02:01 +00:00
Kevin E Martin
0881bb3ce0 Add appropriate lib*_CFLAGS to Makefile.am's -- fixes build problems 2005-07-02 06:35:03 +00:00
Daniel Stone
caa910e492 Import Xcursor 1.1.4 from freedesktop.org xlibs tree. 2005-06-29 18:46:53 +00:00
Daniel Stone
e67de73f5c Bug #1043: Fix leak when creating animated cursors. 2005-06-13 16:44:53 +00:00
Søren Sandmann Pedersen
4070c0af6c - Add Xcursor build system 2005-06-08 19:15:43 +00:00
Markus Kuhn
50911b052c Encoding of numerous files changed to UTF-8 2004-12-04 00:42:47 +00:00
Egbert Eich
cbcf471d91 Merging XORG-CURRENT into trunk 2004-04-23 18:43:40 +00:00
Egbert Eich
fb1739bd22 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 2004-03-14 08:32:05 +00:00
Egbert Eich
bfcfbe061f Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 2004-03-03 12:11:23 +00:00
Egbert Eich
c450b74503 readding XFree86's cvs IDs 2004-02-26 13:35:32 +00:00
Egbert Eich
79b8e8b996 Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 2004-02-26 09:22:42 +00:00
Kaleb Keithley
969878fc6f XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks 2003-11-25 19:28:09 +00:00
Kaleb Keithley
3b84b14bf0 Initial revision 2003-11-14 16:48:48 +00:00