Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/fix lib x11 compilation warnings #2

Closed
wants to merge 212 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
902cba2
XStringToKeysym: Special case for XF86 keysyms
fooishbar Jun 15, 2010
0f6b0da
Delete now-redundant XKeysymDB
fooishbar Jun 15, 2010
1059364
XStringToKeysym: Check strdup() return value
fooishbar Jul 8, 2010
98e6f96
XStringToKeysym: Cope with 0x1234cafe-style input
fooishbar Jul 9, 2010
defc8de
LINEAR_RGB_InitSCCData: When malloc fails, don't try to free unalloca…
alanc Jun 4, 2010
ae72fab
Initialize event type
Jan 3, 2011
92d7ad7
Using freed pointer "e"
eras Jan 10, 2011
f8bb7ea
Dereferencing possibly NULL "str" in call to function "memcpy" (Deref…
eras Jan 27, 2011
830b496
Variable "entry" tracked as NULL was dereferenced.
eras Jan 12, 2011
610627d
Comparing array against NULL is not useful "&xkb->server->vmods != NULL"
eras Jan 18, 2011
e169ea2
XDefaultOMIF.c: Fix memory leaks in get_font_name
alanc Feb 1, 2011
b3110de
xcmx/cmxColNm: Removed unused assignments to pBuf (in two functions)
eras Jan 31, 2011
e4ca03f
xlibi18n/lcGeneric: Initialize uninitialized local variable
eras Jan 31, 2011
ad12055
ImUtil: Handle a memory leak in one early return branch
eras Jan 31, 2011
2f73378
Xrm: NEWTABLE had a memory leak after a memory allocation error
eras Jan 31, 2011
cc90917
xcms/LRGB: Fix potential resource leak.
Jan 31, 2011
3ae70a4
xcms/LRGB: Add a label for freeing property_return.
Feb 1, 2011
792bb8a
XlibInt: info_list->watch_data was reallocated, but result was discarded
Jan 31, 2011
8b61c92
xlibi18n/lcFile: Removed superfluous check for NULL target_dir
eras Jan 31, 2011
041e660
XlibInt: Use strncpy+zero termination instead of strcpy to enforce bu…
eras Jan 31, 2011
8e034d2
Expand GetSizeOfFile() macro at the one place it's called
alanc Feb 2, 2011
ed336b1
Xrm.c: ReadInFile: refactor fstat error handling
alanc Feb 2, 2011
21efc06
xcms/LRGB: don't double-free property_return
Jan 31, 2011
06360f6
cmsProp: don't deal with uninitialized values, fail instead
eras Feb 3, 2011
7bc3938
Clean up memory when first XCreateRegion succeeds and second fails
alanc Feb 11, 2011
ca5be09
keyBind: Use Xcalloc to initialize allocated _XKeytrans
eras Jan 10, 2011
7c09bef
xkb: XkbPropertyPtr determined allocation success from wrong variables
eras Jan 18, 2011
0517ca7
Add #define XK_SINHALA
harshula Mar 21, 2011
217f791
Fix memory leak with broken bitmap files in XReadBitmapFileData
Mar 23, 2011
abb19bd
FSWrap: fix potential leak in copy_string_list
Mar 24, 2011
c697b91
xcms: Fix error on LINEAR_RGB_InitSCCData error path.
Mar 30, 2011
06b4b85
xcms: Fix memory leaks on LINEAR_RGB_InitSCCData error path.
Mar 30, 2011
fe981ad
Fix memory leaks on _XimGetAttributeID error paths.
Mar 24, 2011
3753710
Replace Xmalloc+bzero pairs with Xcalloc calls
alanc Apr 13, 2011
30419d2
Convert malloc(strlen()); strcpy() sets to strdup
alanc Apr 13, 2011
2cb8323
Delete special case code to append "/sparcv9" to i18n module path
alanc Apr 21, 2011
42a60fb
Dead code removal
jeremyhu May 4, 2011
cd99026
XKB: XkbComputeSectionBounds: Check correct bounds in default switch-…
jeremyhu May 4, 2011
fb3461e
XIM: Make Xim handle NEED_SYNC_REPLY flag
choehwanjin Oct 12, 2011
0c4294a
Add _XGetRequest as substitute for GetReq/GetReqExtra
whot Oct 16, 2011
d3c9cfc
XlcSL.c: convert old-style function definitions to ANSI C89 style
alanc Nov 10, 2011
9da0e52
Reject negative string counts in copy_string_list
alanc Nov 30, 2011
13f89fb
XQueryColors: Split a request into multiple requests if necessary
k7k7 Dec 14, 2011
dd3dc89
Use pthreads on MinGW also
rpavlik Jan 1, 2012
376945b
Provide translation from XK_permille (ad5) to Unicode (U2030)
myllynen Feb 20, 2011
08c140f
Block for other threads in _XUserLockDisplay
keith-packard Mar 4, 2012
34198fc
Remove "register" qualifier that annoys Solaris Studio compiler
alanc Mar 16, 2012
b67348e
Typo fix
whot Apr 30, 2012
3b9cd2c
Match braille patterns with compose tree
sthibaul Feb 21, 2011
04fcefd
XIM: Allow modifier releases in compose sequences (#26705)
Nov 8, 2011
df13785
Fix "nomal" -> "normal" typo in several comments
alanc Oct 15, 2011
c916a00
mbtocs should not truncate input
Oct 15, 2011
7b2b8e0
Return name instead of False in XSetICValues()
ydroneaud Oct 11, 2011
061772c
Return name instead of value in XGetIMValues() and XSetIMValues()
ydroneaud Oct 9, 2011
6e13ade
Fix potential uninitialized variable access in _XimMakeICAttrIDList
jeremyhu Oct 9, 2011
571cff5
om: Fix memory leaks on get_font_name error paths.
Mar 25, 2011
bb184cf
om: Fix potential memory leak in init_om.
Mar 25, 2011
5044c22
om: Fix memory leak on read_EncodingInfo error path.
Mar 24, 2011
d39e6c6
Fix memory leaks on _XimCbDispatch error path.
Mar 24, 2011
d75ff3e
Fix memory leak on _XimCommitRecv error path.
Mar 24, 2011
53fdefd
Fix memory leaks on _XimWriteCachedDefaultTree error paths.
Mar 24, 2011
60a06c2
Fix memory leaks on _XimProtoCreateIC error paths.
Mar 24, 2011
7faf0ec
Fix leaks in _XimEncodingNegotiation error paths.
Mar 24, 2011
f89d43c
Fix "attrinute" typo in comments in ximcp
alanc Apr 13, 2011
e0a6dcc
im/ximcp: release modifiermap before returning
eras Jan 10, 2011
084f926
Make the Local XIM request key releases for braille
sthibaul Feb 21, 2011
8cc9a76
Fix status reporting for braille patterns
sthibaul Feb 21, 2011
5f32a7d
lc/def/lcDefConv: Use Xcalloc to avoid use of uninitialized memory
Jan 31, 2011
c9d0dad
ximcp/imLckup: Handle negative return value from _Xlcwctomb
eras Jan 31, 2011
666f5e7
ximcp/imTrX: Handle failing XGetWindowProperty
eras Jan 31, 2011
f56c0ba
ximcp/imRm: Handle leaking colormap_ret
eras Jan 31, 2011
5e98cf8
ximcp/imRmAttr: Handle leaking missing_list
eras Jan 31, 2011
7988a44
Use GetReqSized for GetReq and GetReqExtra
whot Oct 27, 2011
54765cc
include: Add GetReqSized() for request buffers of specific size
whot Oct 14, 2011
ec5aefd
Switch GetEmptyReq and GetResReq to call _XGetRequest
whot Oct 27, 2011
4646512
libX11: Fixing modifier key range in Xutil.h (Bug #21910)
bodograumann Oct 10, 2011
57f29dc
Mark XKeycodeToKeysym as _X_DEPRECATED
jeremyhu Oct 10, 2011
f32c934
Fix man page and comment references to use XFreeModifiermap (lowercas…
alanc May 18, 2011
2b63780
Silence clang static analysis warnings for SetReqLen
jeremyhu May 8, 2011
0bf1ded
clang analyzer: Don't warn about Xmalloc(0)
jeremyhu May 3, 2011
118b976
Events: Store event cookie when dequeuing event
Dec 22, 2010
dbef461
XCreate{Pix,Bit}map...Data: Free pixmap in error path if XCreateGC fails
alanc Jun 30, 2012
1115cf8
Convert XCreate{Pix,Bit}map...Data to use C99 designated initializers
alanc Jun 30, 2012
b3fa9b7
XIM: remove Private and Public macros
yselkowitz Oct 22, 2012
5991ba1
Don't hard code path to Xcms.txt file.
May 20, 2011
8eab855
Remove unused TLI ("STREAMSCONN") code from Xlib
alanc Dec 27, 2012
fae737a
Remove unused DECnet ("DNETCONN") code from Xlib
alanc Dec 27, 2012
6536e0b
cmsColNm.c: maintain constness of arguments to qsort helper function
alanc Feb 16, 2013
be64ca2
XRebindKeysym: Drop unnecessary const-removing cast
alanc Feb 16, 2013
c85abe6
XStringToKeysym: preserve constness when casting off unsignedness for…
alanc Feb 16, 2013
a51b938
Preserve constness in casting arguments through the Data*() routines
alanc Feb 16, 2013
1ba4005
XKeysymToString: move variable declarations to the scope of their usage
alanc Feb 16, 2013
4e2b3e9
Convert more sprintf calls to snprintf
alanc Feb 16, 2013
f7a159f
unifdef XKB_IN_SERVER
alanc Mar 2, 2013
d4e3600
Assume size_t is always available, since it was defined in C89
alanc Mar 2, 2013
d19925d
_xudc_code_to_glyph: check for NULL pointer *before* writing to it, n…
alanc Mar 9, 2013
d9dd750
XAllocClassHint: Assume calloc sets pointers in allocated memory to NULL
alanc Mar 8, 2013
ad8cd71
Fix very weird indenting in nx-X11/lib/X11/GetFProp.c
alanc Mar 9, 2013
8c3ba12
Move big request comment in XOpenDisplay to the right place
alanc Mar 17, 2013
e0b20d5
Remove more unnecessary casts from Xmalloc/calloc calls
alanc Mar 8, 2013
62b653b
Revert "Add a couple fixups for the security patches"
uli42 Oct 6, 2016
63ae456
xkb: fix off-by-one in _XkbReadGetNamesReply and _XkbReadVirtualModMap
jcristau May 23, 2013
8ff6cfe
Free fs->properties in XF86BigfontQueryFont overflow error path
alanc May 17, 2013
fbe284c
Make sure internal headers include required headers
niveditharau May 17, 2013
fafc5b0
cmsMath.c: Add missing stdio header for printf(3) in DEBUG build.
0-wiz-0 Jun 2, 2013
fe76f1a
rename xf86bigfstr.h to xf86bigfproto.h
uli42 Oct 7, 2016
b0c9db1
Assume size_t is always available, since it was defined in C89
uli42 Oct 7, 2016
653f1e5
Sun's copyrights are now owned by Oracle
alanc Sep 4, 2010
43ec736
Revert incomplete "Fix status reporting for braille patterns"
uli42 Oct 7, 2016
742e513
Fix status reporting for braille patterns
sthibaul Feb 21, 2011
3b55bda
ximcp/imRmAttr: Handle leaking colormap_ret
eras Jan 31, 2011
b1d14b7
integer overflow in ReadInFile() in Xrm.c [CVE-2013-1981 7/13]
alanc Mar 2, 2013
6c33365
GetProp: Zero-initialized error so its resourceID field is initialized
eras Jan 31, 2011
7f5b2cd
Zero buffer data in BufAlloc()
nwnk Sep 8, 2010
fff507c
Tell clang not to report -Wpadded warnings on public headers we can't…
alanc Dec 17, 2012
0cc0404
Align files with upstream libX11-1.6.0
uli42 Oct 7, 2016
cf01ecb
update Xfuncproto.h
uli42 Oct 7, 2016
49d9d76
Require ANSI C89 pre-processor, drop pre-C89 token pasting support
alanc Jun 25, 2013
4ac6c51
Stop truncating source to destination length if it is larger.
0-wiz-0 Jun 25, 2013
acf68ef
Check for symbol existence with #ifdef, not #if
0-wiz-0 Jun 25, 2013
aa800a5
Fix out-of-range comparison in _XF86BigfontQueryFont
0-wiz-0 Jun 25, 2013
52e458d
Tighten out-of-range comparisons.
0-wiz-0 Jun 25, 2013
ea623c5
libX11: check size of GetReqExtra after XFlush
kees Jun 9, 2013
22c0497
XSetModifierMapping: Use Data instead of GetReqExtra
alanc Jul 24, 2013
77dc89e
omGeneric: remove space between struct name & member name
alanc Jul 27, 2013
c0814d9
XIM: Fix race on focus change: set 'FABRICATED' only when keyev filte…
Jun 16, 2011
9a12df4
Fix bogus timestamp generated by XIM
zephyrus00jp Dec 18, 2012
0a161f6
Fix file leak on malloc error in XlcDL.c:resolve_object()
alanc Aug 10, 2013
62de557
lcfile: skip over any null entries in args list
alanc Aug 10, 2013
9d98658
xlibi18n: convert sprintf calls to snprintf
alanc Aug 10, 2013
5e13c2f
ximcp/imRm.c: convert sprintf calls to snprintf
alanc Aug 10, 2013
e3718c1
omGeneric.c: convert sprintf calls to snprintf
alanc Aug 10, 2013
fbdcb0d
Avoid memory leak/corruption if realloc fails in XlcDL.c:resolve_obje…
alanc Aug 10, 2013
0728f44
lcDB.c: ensure buffer size is updated correctly if realloc fails
alanc Aug 10, 2013
297e8e4
Avoid memory leak/corruption if realloc fails in imLcPrs.c:parseline()
alanc Aug 10, 2013
f9cc2e2
Avoid memory leak/corruption if realloc fails in Xregion.h:MEMCHECK m…
alanc Aug 10, 2013
deaa543
miRegionCopy(): handle realloc failure better
alanc Aug 10, 2013
7c271f9
miRegionOp(): ensure region size is not updated if realloc fails
alanc Aug 10, 2013
bffab88
Delete unused XKB_INSURE_SIZE macro from XKBlibint.h
alanc Aug 10, 2013
5476d96
init_om: remove unneeded extra copy of string to local buffer
alanc Aug 10, 2013
e853fef
Constify lc_name argument to _XlcLocaleDirName() & _XlcLocaleLibDirNa…
alanc Aug 11, 2013
cde832d
Fix const handling in XSetLocaleModifiers
alanc Aug 11, 2013
c435d7d
xlibi18n: Fix a bunch of const cast warnings
alanc Aug 11, 2013
4053f2e
i18n modules: Fix some const cast warnings
alanc Aug 11, 2013
21653a5
xlibi18n: fix argsize argument to _XlcParsePath
alanc Aug 11, 2013
a25e241
Remove even more casts of return values from Xmalloc/Xrealloc
alanc Aug 11, 2013
d54f599
Don't cast sizeof() results to unsigned when passing to Xmalloc/Xcalloc
alanc Aug 11, 2013
39dc526
Remove unnecessary casts of pointers to (char *) in calls to Xfree()
alanc Aug 11, 2013
ca2d4d3
Remove long unused udcInf.c
alanc Aug 12, 2013
b0062fe
Fix overflow checks in _XkbReadKeySyms when key_sym_map is already cr…
alanc Aug 17, 2013
3510d36
Reindent XKB code to X.Org standard style
alanc Aug 11, 2013
05ff257
Rearrange some variable declarations & initializations in XKB
alanc Aug 17, 2013
cfb2257
Stop checking for HAVE_DIX_CONFIG_H on the client side
alanc Aug 17, 2013
eb9954b
Bug 68413 - [Bisected]Error in `xterm': realloc(): invalid next size
alanc Aug 25, 2013
6e72145
Drop X_LOCALE fallback for OS'es without setlocale()
alanc Nov 17, 2013
929b338
unifdef -UISC
alanc Dec 3, 2013
efa64fc
Don't try so hard to find a matching font with the given encoding
jon-turney Oct 7, 2010
9aa870b
XkbSelectEventDetails: remove unnecessary assignments
alanc Dec 26, 2013
f7b74fb
_XkbReadGeomOverlay: check for NULL first, then use pointer
alanc Dec 26, 2013
8c01bb1
Fix typos in Xrm.c comments
alanc Feb 6, 2014
33f10b0
Remove dead USE_OWN_COMPOSE-protected code
bluetech Feb 11, 2014
36e0dbd
Fix XNextRequest() after direct usage of XCB
owtaylor May 9, 2014
7b13296
libX11/lcGenConv.c fix: dereferenced before check
Jun 4, 2014
29c8646
libX11/XKBNames.c fix: dereferenced before check
Jun 4, 2014
0cedbf8
libX11/lcUTF8.c fix: dereferenced before check
Jun 4, 2014
7f7f065
Remove redundant null checks before free
Jun 5, 2014
3f18a46
Remove more redundant null checks before Xfree()
Jun 6, 2014
b74f89e
libX11: rm redundante NULL checks
Jun 7, 2014
9929fc8
rm redundant null checks
Jun 7, 2014
c1aa552
lcDefConv.c: fix use before check
Jun 7, 2014
3bd1b2b
Fix map->num_types check in XkbAddKeyType()
alanc Jul 6, 2014
add864b
Fix validation of ctrls parameter to XkbGetPerClientControls()
alanc Jul 6, 2014
86b6cc4
Use C99 named initializers to fill in events passed to XSendEvent
alanc Jul 11, 2014
1276727
compose: fix the description of modifiers in compose sequences
bluetech Feb 3, 2015
cfddace
Fix potential memory leak
whot May 17, 2015
671b904
Fix three "use of uninitialized variable" coverity warnings
whot May 19, 2015
b8b11fd
omGeneric.c: Correct the parameter usage of sizeof
Jun 5, 2015
2f9d12d
Replace Xmalloc+memset pairs with Xcalloc calls
alanc Jun 5, 2015
62dcd4a
Add missing NULL checks to ICWrap
rossburton May 18, 2015
30d713a
Do not return() after exit().
0-wiz-0 Jul 19, 2015
19baa6b
Get rid of some extraneous ; at the end of C source lines
alanc Sep 28, 2015
85aab04
Remove unused definition of XCONN_CHECK_FREQ
alanc Nov 28, 2015
4e8ddaa
Bug 93184: read_EncodingInfo invalid free
alanc Dec 4, 2015
927ce22
Bug 93183: _XDefaultOpenIM memory leaks in out-of-memory error paths
alanc Dec 4, 2015
c657afc
Delete #if 0 hunks of code
alanc Dec 5, 2015
6198254
Use strdup instead of Xmalloc+strcpy in _XDefaultOpenIM
alanc Dec 19, 2015
c1b2546
XDefaultOMIF: replace strlen+Xmalloc+strcpy with strdup
alanc Dec 19, 2015
dc466bf
XDefaultOMIF: additional code simplification
alanc Dec 19, 2015
75d1ea2
XDefaultOMIF: Remove comments referring to ancient Sun bug ids
alanc Dec 19, 2015
fe7b003
XlcDL.c: replace strcpy+strcat sequences with snprintf
alanc Dec 19, 2015
5b73b86
XlcDL.c: reduce code duplication
alanc Dec 19, 2015
7c2c152
lcPubWrap: replace malloc(strlen) + strcpy with strdup
alanc Dec 20, 2015
7e681ba
XKB: fix XkbGetKeyboardByName with Xming server
ofourdan Jan 21, 2016
28fcda4
Xlib.h: Fix macros imitating C functions.
Mar 26, 2015
ed1b8ee
xcms: use size_t for strlen/sizeof values instead of converting to in…
alanc Feb 6, 2016
3137e16
xcms: use unsigned indexes when looping through unsigned values
alanc Feb 6, 2016
502f9cb
xcms: use size_t for pointer offsets passed to strncmp
alanc Feb 6, 2016
2058c18
The validation of server responses avoids out of boundary accesses.
stoeckmann Sep 25, 2016
ea3d9ff
Validation of server responses in XGetImage()
stoeckmann Sep 25, 2016
8462f39
Fix libX11 implicit declaration warnings
uli42 Oct 15, 2016
9abde45
Pending.c: Fix compilation warning
uli42 Oct 15, 2016
ed3337a
imLcIm.c: Fix unused variables
uli42 Oct 15, 2016
72aaede
Args.c: fix string format warning
uli42 Oct 15, 2016
fb33fd2
Colormap.c: add cast to avoid warning
uli42 Oct 15, 2016
a4f146c
Display.c: remove unused variable
uli42 Oct 15, 2016
4f72e67
Window.c: Fix function assignment warning
uli42 Oct 15, 2016
943fe90
nxagent: replace deprecated function call XKeycodeToKeysym
uli42 Oct 15, 2016
3032aba
Loop.cpp: Fix output of SetCore()
uli42 Oct 15, 2016
986c54f
security.c: fix compiler warnings
uli42 Oct 15, 2016
6b9d3db
xcmisc.c: remove HAVE_STDINT
uli42 Oct 15, 2016
2878eea
xkmread.c: use _X_UNUSED to avoid compiler warning when result is not…
uli42 Oct 15, 2016
3ae6aab
xkb.c: fix 'assignment makes integer from pointer without a cast'
uli42 Oct 15, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Validation of server responses in XGetImage()
Check if enough bytes were received for specified image type and
geometry. Otherwise GetPixel and other functions could trigger an
out of boundary read later on.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
  • Loading branch information
stoeckmann authored and uli42 committed Oct 15, 2016
commit ea3d9ffee08356a49fa488e4eb8fd5a7ed4d28c2
29 changes: 20 additions & 9 deletions nx-X11/lib/X11/GetImage.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ XImage *XGetImage (
char *data;
unsigned long nbytes;
XImage *image;
int planes;
LockDisplay(dpy);
GetReq (GetImage, req);
/*
Expand Down Expand Up @@ -91,18 +92,28 @@ XImage *XGetImage (
return (XImage *) NULL;
}
_XReadPad (dpy, data, nbytes);
if (format == XYPixmap)
image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual),
Ones (plane_mask &
(((unsigned long)0xFFFFFFFF) >> (32 - rep.depth))),
format, 0, data, width, height, dpy->bitmap_pad, 0);
else /* format == ZPixmap */
image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual),
rep.depth, ZPixmap, 0, data, width, height,
_XGetScanlinePad(dpy, (int) rep.depth), 0);
if (format == XYPixmap) {
image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual),
Ones (plane_mask &
(((unsigned long)0xFFFFFFFF) >> (32 - rep.depth))),
format, 0, data, width, height, dpy->bitmap_pad, 0);
planes = image->depth;
} else { /* format == ZPixmap */
image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual),
rep.depth, ZPixmap, 0, data, width, height,
_XGetScanlinePad(dpy, (int) rep.depth), 0);
planes = 1;
}

if (!image)
Xfree(data);
if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 ||
INT_MAX / image->height <= image->bytes_per_line ||
INT_MAX / planes <= image->height * image->bytes_per_line ||
nbytes < planes * image->height * image->bytes_per_line) {
XDestroyImage(image);
image = NULL;
}
UnlockDisplay(dpy);
SyncHandle();
return (image);
Expand Down