git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@70951
7cbeb6ba-43b4-40fd-8cce-
4c39aea84d33
2012-05-10 Jiyoun Park
* Send mouse move event before mouse down event in ecore_extn
2012-05-10 Jiyoun Park
* Send mouse move event before mouse down event in ecore_extn
+
+2012-05-13 Carsten Haitzler (The Rasterman)
+
+ * Fix ecore-x randr issues with memory access when building
+ output arrays which are memory segv bugs waiting to crash.
root = ecore_x_window_root_get(window);
crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
root = ecore_x_window_root_get(window);
crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs);
- if (!crtcs) return NULL;
+ if (!crtcs) goto _ecore_x_randr_window_crtcs_get_fail;
/* now get window RELATIVE to root window - thats what matters. */
cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
/* now get window RELATIVE to root window - thats what matters. */
cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0);
w_geo.y = trans->dst_y;
free(trans);
w_geo.y = trans->dst_y;
free(trans);
+ ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
+ if (!ret)
+ {
+ free(crtcs);
+ goto _ecore_x_randr_window_crtcs_get_fail;
+ }
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
- ret = realloc(ret, (++nret *
- sizeof(Ecore_X_Randr_Output)));
if (num) *num = nret;
return ret;
if (num) *num = nret;
return ret;
+_ecore_x_randr_window_crtcs_get_fail:
#endif
if (num) *num = 0;
return NULL;
#endif
if (num) *num = 0;
return NULL;
#ifdef ECORE_XCB_RANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
#ifdef ECORE_XCB_RANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
- Ecore_X_Randr_Output *outputs, *ret = NULL;
+ Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
int ncrtcs, noutputs, i, nret = 0;
#endif
int ncrtcs, noutputs, i, nret = 0;
#endif
&noutputs);
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
&noutputs);
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
- nret += noutputs;
- ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
+ tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
+ if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
+ ret = tret;
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
w_geo.x = rx;
w_geo.y = ry;
w_geo.x = rx;
w_geo.y = ry;
+ ret = calloc(1, ncrtcs * sizeof(Ecore_X_Randr_Crtc));
+ if (!ret)
+ {
+ free(crtcs);
+ goto _ecore_x_randr_window_crtcs_get_fail;
+ }
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
for (i = 0, nret = 0; i < ncrtcs; i++)
{
/* if crtc is not enabled, don't bother about it any further */
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
&c_geo.w, &c_geo.h);
if (eina_rectangles_intersect(&w_geo, &c_geo))
{
- ret = realloc(ret, (sizeof(Ecore_X_Randr_Crtc) * ++nret));
#ifdef ECORE_XRANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
#ifdef ECORE_XRANDR
Ecore_X_Window root;
Ecore_X_Randr_Crtc *crtcs;
- Ecore_X_Randr_Output *outputs, *ret = NULL;
+ Ecore_X_Randr_Output *outputs, *ret = NULL, *tret;
int ncrtcs, noutputs, i, nret = 0;
if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
int ncrtcs, noutputs, i, nret = 0;
if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail;
root = ecore_x_window_root_get(window);
if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
goto _ecore_x_randr_current_output_get_fail;
root = ecore_x_window_root_get(window);
if (!(crtcs = ecore_x_randr_window_crtcs_get(window, &ncrtcs)))
goto _ecore_x_randr_current_output_get_fail;
for (i = 0, nret = 0; i < ncrtcs; i++)
{
outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
for (i = 0, nret = 0; i < ncrtcs; i++)
{
outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i],
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
if (!outputs)
goto _ecore_x_randr_current_output_get_fail_free;
- nret += noutputs;
- ret = realloc(ret, (nret * sizeof(Ecore_X_Randr_Output)));
+ tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output)));
+ if (!tret) goto _ecore_x_randr_current_output_get_fail_free;
+ ret = tret;
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));
memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output)));