discomfitor pushed a commit to branch master.
commit c3916df200704b22fd88c5c5498ea4777e050ffd
Author: Mike Blumenkrantz <[email protected]>
Date: Mon Jul 15 09:36:06 2013 +0100
clamp size to ximage size for ecore_x_image_get to prevent BadMatch errors
---
ChangeLog | 4 ++++
NEWS | 1 +
src/lib/ecore_x/xcb/ecore_xcb_image.c | 4 ++--
src/lib/ecore_x/xlib/ecore_x_image.c | 4 ++--
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d963400..d4d88a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-07-15 Mike Blumenkrantz
+
+ * Ecore-X: fix BadMatch errors in ecore_x_image_get when requested
size was larger than XImage size
+
2013-07-15 Cedric Bail
* Eet: Add support for EET_T_VALUE to serialize Eina_Value pointer.
diff --git a/NEWS b/NEWS
index 6069904..c71b20f 100644
--- a/NEWS
+++ b/NEWS
@@ -342,6 +342,7 @@ Fixes:
- Fix alpha set function not clear sync counter.
- Fix selection parser to not overrun buffer read by using longs on 64bit.
- Fix x11 selection trailing nul byte in text.
+ - Fix BadMatch errors in ecore_x_image_get when requested size was larger
than XImage size
* Ecore_Wayland:
- Fix return type of function ecore_wl_outputs_get().
* Ecore_Input_Evas:
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_image.c
b/src/lib/ecore_x/xcb/ecore_xcb_image.c
index bce5df3..67a1470 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_image.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_image.c
@@ -96,8 +96,8 @@ ecore_x_image_get(Ecore_X_Image *im,
{
im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) +
(sx * im->bpp);
- im->xim->width = w;
- im->xim->height = h;
+ im->xim->width = MIN(w, im->w);
+ im->xim->height = MIN(h, im->h);
ecore_x_grab();
if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim,
diff --git a/src/lib/ecore_x/xlib/ecore_x_image.c
b/src/lib/ecore_x/xlib/ecore_x_image.c
index 3ae9b63..af7417e 100644
--- a/src/lib/ecore_x/xlib/ecore_x_image.c
+++ b/src/lib/ecore_x/xlib/ecore_x_image.c
@@ -293,8 +293,8 @@ ecore_x_image_get(Ecore_X_Image *im,
{
im->xim->data = (char *)
im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp);
- im->xim->width = w;
- im->xim->height = h;
+ im->xim->width = MIN(w, im->w);
+ im->xim->height = MIN(h, im->h);
XGrabServer(_ecore_x_disp);
if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff))
ret = EINA_FALSE;
--
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk