summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary casts of return values from malloc()Alan Coopersmith2022-10-177-10/+10
| | | | | | Not needed in C89 and later Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Variable scope reductions as recommended by cppcheckAlan Coopersmith2022-10-177-52/+41
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* XRRGetProviderInfo: Remove unneeded ProviderInfoExtraAlan Coopersmith2022-10-171-9/+5
| | | | | | | | | | | | | | | | | It was always 0, hence caused gcc warnings: XrrProvider.c: In function ‘XRRGetProviderInfo’: XrrProvider.c:133:49: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (rep.length > INT_MAX >> 2 || rep.length < ProviderInfoExtra >> 2) ^ XrrProvider.c:135:17: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] if (rep.length < ProviderInfoExtra >> 2) ^ XrrProvider.c:135:5: warning: this condition has identical branches [-Wduplicated-branches] if (rep.length < ProviderInfoExtra >> 2) ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix spelling/wording issuesAlan Coopersmith2022-07-171-2/+2
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix memory leak on error pathsTobias Stoeckmann2017-01-281-0/+4
| | | | | | | Introduced in commit a0df3e1c7728205e5c7650b2e6dce684139254a6 "Avoid out of boundary accesses on illegal responses" Signed-off-by: Julien Cristau <jcristau@debian.org>
* Avoid out of boundary accesses on illegal responsesTobias Stoeckmann2016-09-256-52/+172
| | | | | | | | | The responses of the connected X server have to be properly checked to avoid out of boundary accesses that could otherwise be triggered by a malicious server. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
* fix: redundant null check on calling free()walter harms2016-08-151-4/+3
| | | | | | janitorial patch: remove some unneeded if() before free() Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* fix: doGetScreenResources() info: redundant null check on calling free()walter harms2016-08-151-2/+2
| | | | | | janitorial patch: remove some unneeded if() before free() Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Add monitors, update to version 1.5 (v2)libXrandr-1.5.0Keith Packard2015-03-312-1/+202
| | | | | | | | | | v2: [airlied] xrandr was giving the outputs from 0 for each monitor instead of incrementing the pointer. add get_active support. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
* libXrandr: Clean up compiler warningsKeith Packard2015-03-317-54/+54
| | | | | | | | This removes warnings about shadowing local variables with the same name, and type mismatches with _XRead32. Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com>
* Remove fallback for _XEatDataWords, require libX11 1.6 for itMichael Joost2013-11-221-14/+0
| | | | | | | | | | | | | _XEatDataWords was orignally introduced with the May 2013 security patches, and in order to ease the process of delivering those, fallback versions of _XEatDataWords were included in the X extension library patches so they could be applied to older versions that didn't have libX11 1.6 yet. Now that we're past that hurdle, we can drop the fallbacks and just require libX11 1.6 for building new versions of the extension libraries. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* XRRUpdateConfiguration: Check if getting screen for root failsPauli Nieminen2013-07-051-0/+3
| | | | | | | | | | XRRRootToScreen might return -1 if it fails to find screen for the root window. Following code uses screen number unconditionally to index the screen array. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* XRRGetProviderInfo returned bad associated_capability list in 64-bitAlan Coopersmith2013-07-051-1/+10
| | | | | | | | | | | | | | | | | Unlike most of the values returned by this function, which are arrays of XIDs (long int), associated_capability is defined as an array of unsigned int. _XRead32 reads 32-bit values from the wire protocol and writes them to the provided buffer as an array of long ints, even if that means expanding them from 32-bit to 64-bit. Doing that for associated_capability resulted in a garbage value between each actual value, and overflowing the provided buffer into the space for the provider name (which is written later and would overwrite the overflowed data). Created xhiv libXrandr/XRRGetProviderInfo test case to test & confirm. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
* Make XRRGet*Property() always initialize returned valuesAlan Coopersmith2013-05-042-2/+14
| | | | | | | | | | | | Avoids memory corruption and other errors when callers access them without checking to see if the calls returned an error value. Callers are still required to check for errors, this just reduces the damage when they don't. (Same as reported against libX11 XGetWindowProperty by Ilja Van Sprundel) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* integer overflow in XRRGetProviderProperty() [CVE-2013-1986 4/4]Alan Coopersmith2013-05-041-8/+14
| | | | | | | | | | If the reported number of properties is too large, the calculations to allocate memory for them may overflow, leaving us returning less memory to the caller than implied by the value written to *nitems. (Same as reported against libX11 XGetWindowProperty by Ilja Van Sprundel) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* integer overflow in XRRGetOutputProperty() [CVE-2013-1986 3/4]Alan Coopersmith2013-05-041-8/+14
| | | | | | | | | | If the reported number of properties is too large, the calculations to allocate memory for them may overflow, leaving us returning less memory to the caller than implied by the value written to *nitems. (Same as reported against libX11 XGetWindowProperty by Ilja Van Sprundel) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* integer overflow in XRRQueryProviderProperty() [CVE-2013-1986 2/4]Alan Coopersmith2013-05-041-4/+9
| | | | | | Same problem as XRRQueryOutputProperty() that it was cloned from Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* integer overflow in XRRQueryOutputProperty() [CVE-2013-1986 1/4]Alan Coopersmith2013-05-041-4/+9
| | | | | | | | | | | rep.length is a CARD32, while rbytes was a signed int, so rbytes = sizeof (XRRPropertyInfo) + rep.length * sizeof (long); could result in integer overflow, leading to an undersized malloc and reading data off the connection and writing it past the end of the allocated buffer. Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use _XEatDataWords to avoid overflow of rep.length bit shiftingAlan Coopersmith2013-05-037-17/+28
| | | | | | rep.length is a CARD32, so rep.length << 2 could overflow in 32-bit builds Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace deprecated Automake INCLUDES variable with AM_CPPFLAGSbaserock/morphAlan Coopersmith2013-01-181-1/+1
| | | | | | | | | | | | | 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>
* Constify a couple string arguments that are just copied, not modifiedAlan Coopersmith2012-09-062-2/+2
| | | | | | | | | | | Fixes compiler warnings when building app/xrandr: xrandr.c: In function ‘crtc_set_transform’: xrandr.c:1459:9: warning: passing argument 4 of ‘XRRSetCrtcTransform’ discards qualifiers from pointer target type X11/extensions/Xrandr.h:419:1: note: expected ‘char *’ but argument is of type ‘const char *’ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
* libXrandr: add support for provider objects.Dave Airlie2012-07-194-2/+623
| | | | | | | This adds the client side libXrandr support for randr 1.4, and provider objects. Signed-off-by: Dave Airlie <airlied@redhat.com>
* Fill in nameLen in XRROutputInfoDaniel Stone2012-02-291-0/+1
| | | | | | | | | Even though it probably makes more sense to just strlen() the name, for some reason there's a nameLen field in XRROutputInfo, so might as well actually fill it in. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reported-by: Leif Middelschulte <leif.middelschulte@gmail.com>
* Strip trailing whitespaceAlan Coopersmith2011-09-169-71/+71
| | | | | | | Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Purge macros NEED_EVENTS and NEED_REPLIESFernando Carrijo2010-07-081-2/+0
| | | | | | Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add parameter safety checkLeif Middelschulte2010-05-261-1/+1
| | | | | | | | | As mentioned in bugzilla ticket 28150. Calling '_XRRValidateCache' with 'improper' arguments results in a SEGV. This patch adds a parameter validation to the mentioned function. Signed-off-by: Leif Middelschulte <leif.middelschulte@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* config: move CWARNFLAGS from configure.ac to Makefile.amGaetan Nadon2010-02-161-1/+5
| | | | | | | 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>
* GetCrtcGamma: Fix error handling.Adam Jackson2009-11-101-6/+5
| | | | | | | | We didn't treat _XReply failure as fatal. Parsing an xError as a gamma ramp reply doesn't work that often. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
* GetCrtcGammaSize: Return 0, not garbage, on failureAdam Jackson2009-11-101-1/+1
| | | | | Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
* SetScreenConfigAndRate: Document error handling betterAdam Jackson2009-11-101-0/+1
| | | | | Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
* GetOutputProperty: Return the error code, not BadRequestAdam Jackson2009-11-101-1/+1
| | | | | Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
* Send X_RRGetOutputPrimary when making an X_RRGetOutputPrimary requestKeith Packard2009-01-301-1/+1
| | | | | | Using X_RRGetOutputProperty does not yield success here. Signed-off-by: Keith Packard <keithp@keithp.com>
* Janitor: make distcheck, compiler warnings, .gitignorePaulo Cesar Pereira de Andrade2009-01-309-39/+13
| | | | | Warning corrections are either unused symbols or using an integer as a pointer (generated by sparse).
* Fix thinkosJulien Cristau2008-12-232-5/+2
| | | | | * XRRExtensionInfo can be static * XRRExtensionName is not called XrandrExtensionName
* Define _XRRHasRates internally.Adam Jackson2008-12-171-0/+3
|
* Be sure to return NULL when returning no properties.Adam Jackson2008-12-171-1/+1
|
* Use RRCheckExtension in function returning a value.Adam Jackson2008-12-171-1/+1
|
* Fix type of GetReq() argument.Adam Jackson2008-12-171-1/+1
|
* Use RRSimpleCheckExtension in functions returning voidAdam Jackson2008-12-171-1/+1
|
* Add [GS]etOutputPrimaryget-set-primaryAdam Jackson2008-12-081-0/+62
|
* Nuke config-timestamp for panning.Matthias Hopf2008-12-041-2/+0
|
* Panning supportMatthias Hopf2008-12-041-0/+97
|
* RRNotify subevents have 'window' at different offsets, the sequelJulien Cristau2008-12-011-1/+3
| | | | | | | f176b2bda103f6f38aabab8207f47a02cc797659 fixed XRRWireToEvent, but XRREventToWire had the same bug. Signed-off-by: Julien Cristau <jcristau@debian.org>
* Merge branch 'transform-proposal' of git.freedesktop.org:/git/xorg/lib/libXrandrJulien Cristau2008-12-013-9/+210
|\ | | | | | | | | | | Conflicts: src/Xrandr.c
| * Set attr->pendingNparams in XRRGetCrtcTransform()transform-proposalJulien Cristau2008-11-281-0/+1
| |
| * Set NparamsFilter in XRRGetCrtcTransform return value.Keith Packard2008-09-121-0/+1
| | | | | | | | Leaving this uninitialized isn't very helpful, and can cause segfaults.
| * Eliminate inverse matrix from randr transform protocolKeith Packard2008-03-181-8/+0
| | | | | | | | | | It is easier, and potentially more precise, to compute the inverse in the server where everything can eventually be kept in floating point form.
| * Support CRTC Transform filtersKeith Packard2008-03-151-74/+117
| | | | | | | | | | | | | | XRRGetCrtcTransform now returns a giant struct containing all of the transform and filter data. XRRSetCrtcTransform now accepts filter parameters.
| * Add support for new Transform requests.Keith Packard2008-03-103-10/+176
| |
* | Add GetScreenResourcesCurrentgsr-currentAdam Jackson2008-11-241-3/+20
| |