[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51112] trunk/blender/source/blender: fix writing past array bounds in imagewraposa().

Campbell Barton ideasman42 at gmail.com
Sat Oct 6 14:04:10 CEST 2012


Revision: 51112
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51112
Author:   campbellbarton
Date:     2012-10-06 12:04:09 +0000 (Sat, 06 Oct 2012)
Log Message:
-----------
fix writing past array bounds in imagewraposa().

also correct array sizes in othere areas.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
    trunk/blender/source/blender/editors/mesh/editmesh_rip.c
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
    trunk/blender/source/blender/editors/space_view3d/drawobject.c
    trunk/blender/source/blender/render/intern/include/texture.h
    trunk/blender/source/blender/render/intern/source/imagetexture.c

Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -689,7 +689,7 @@
 /********************************* Comparison ********************************/
 
 
-MINLINE int is_zero_v2(const float v[3])
+MINLINE int is_zero_v2(const float v[2])
 {
 	return (v[0] == 0 && v[1] == 0);
 }

Modified: trunk/blender/source/blender/editors/mesh/editmesh_rip.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_rip.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/editors/mesh/editmesh_rip.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -57,7 +57,7 @@
 
 /* helper to find edge for edge_rip */
 static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4],
-                                   const float co1[3], const float co2[2], const float mvalf[2])
+                                   const float co1[3], const float co2[3], const float mvalf[2])
 {
 	float vec1[3], vec2[3];
 

Modified: trunk/blender/source/blender/editors/mesh/editmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_select.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/editors/mesh/editmesh_select.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -448,7 +448,7 @@
 }
 
 /* returns labda for closest distance v1 to line-piece v2 - v3 */
-float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3])
+float labda_PdistVL2Dfl(const float v1[2], const float v2[2], const float v3[2])
 {
 	float rc[2], len;
 	

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_utils.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -201,7 +201,7 @@
 
 static void imapaint_tri_weights(Object *ob,
                                  const float v1[3], const float v2[3], const float v3[3],
-                                 const float co[3], float w[3])
+                                 const float co[2], float w[3])
 {
 	float pv1[4], pv2[4], pv3[4], h[3], divw;
 	float model[4][4], proj[4][4], wmat[3][3], invwmat[3][3];

Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -5945,8 +5945,8 @@
 
 	if (mb->editelems) {
 		if ((G.f & G_PICKSEL) == 0) {
-			unsigned char wire_col[3];
-			UI_GetThemeColor3ubv(TH_WIRE, wire_col);
+			unsigned char wire_col[4];
+			UI_GetThemeColor4ubv(TH_WIRE, wire_col);
 			glColor3ubv(wire_col);
 
 			drawDispList(scene, v3d, rv3d, base, dt, dflag, wire_col);

Modified: trunk/blender/source/blender/render/intern/include/texture.h
===================================================================
--- trunk/blender/source/blender/render/intern/include/texture.h	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/render/intern/include/texture.h	2012-10-06 12:04:09 UTC (rev 51112)
@@ -76,7 +76,7 @@
 
 /* imagetexture.h */
 
-int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[3], const float dyt[3], struct TexResult *texres);
+int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], const float dxt[2], const float dyt[2], struct TexResult *texres);
 int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
 void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float result[4]);
 

Modified: trunk/blender/source/blender/render/intern/source/imagetexture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/imagetexture.c	2012-10-06 12:00:54 UTC (rev 51111)
+++ trunk/blender/source/blender/render/intern/source/imagetexture.c	2012-10-06 12:04:09 UTC (rev 51112)
@@ -1018,7 +1018,7 @@
 	
 }
 
-static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[3], float dyt[3], TexResult *texres)
+static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], float dxt[2], float dyt[2], TexResult *texres)
 {
 	TexResult texr;
 	float fx, fy, minx, maxx, miny, maxy;
@@ -1412,17 +1412,17 @@
 }
 
 
-int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[3], const float DYT[3], TexResult *texres)
+int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const float DXT[2], const float DYT[2], TexResult *texres)
 {
 	TexResult texr;
-	float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[3], dyt[3];
+	float fx, fy, minx, maxx, miny, maxy, dx, dy, dxt[2], dyt[2];
 	float maxd, pixsize, val1, val2, val3;
 	int curmap, retval, imaprepeat, imapextend;
 
 	/* TXF: since dxt/dyt might be modified here and since they might be needed after imagewraposa() call,
 	 * make a local copy here so that original vecs remain untouched */
-	copy_v3_v3(dxt, DXT);
-	copy_v3_v3(dyt, DYT);
+	copy_v2_v2(dxt, DXT);
+	copy_v2_v2(dyt, DYT);
 
 	/* anisotropic filtering */
 	if (tex->texfilter != TXF_BOX)




More information about the Bf-blender-cvs mailing list