Bug 1043 - COGL calls glTexSubImage2D() with out-of-bounds

values (SIGSEGV)

	* clutter/cogl/gl/cogl-texture.c
	(_cogl_texture_upload_subregion_to_gl): When iterating over the
	slices, discard ones that don't intersect immediatly otherwise it
	will call glTexSubImage2D with a negative width/height and then
	move the source position incorrectly. Thanks to Gwenole
	Beauchesne.
This commit is contained in:
Neil Roberts 2008-10-20 15:54:17 +00:00
parent 0cd9345864
commit 96c1a8543d
2 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,15 @@
2008-10-20 Neil Roberts <neil@linux.intel.com>
Bug 1043 - COGL calls glTexSubImage2D() with out-of-bounds
values (SIGSEGV)
* clutter/cogl/gl/cogl-texture.c
(_cogl_texture_upload_subregion_to_gl): When iterating over the
slices, discard ones that don't intersect immediatly otherwise it
will call glTexSubImage2D with a negative width/height and then
move the source position incorrectly. Thanks to Gwenole
Beauchesne.
2008-10-20 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-color.h: Declare clutter_color_new() in the

View File

@ -395,6 +395,13 @@ _cogl_texture_upload_subregion_to_gl (CoglTexture *tex,
_cogl_span_iter_next (&y_iter),
source_y += inter_h )
{
/* Discard slices out of the subregion early */
if (!y_iter.intersects)
{
inter_h = 0;
continue;
}
/* Iterate horizontal spans */
for (source_x = src_x,
_cogl_span_iter_begin (&x_iter, tex->slice_x_spans,
@ -406,6 +413,13 @@ _cogl_texture_upload_subregion_to_gl (CoglTexture *tex,
_cogl_span_iter_next (&x_iter),
source_x += inter_w )
{
/* Discard slices out of the subregion early */
if (!x_iter.intersects)
{
inter_w = 0;
continue;
}
/* Pick intersection width and height */
inter_w = CLUTTER_FIXED_TO_INT (x_iter.intersect_end -
x_iter.intersect_start);