[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46264] trunk/blender/source/blender/imbuf /intern/tiff.c: Fix #31286: saving 16 bit BW tiff could crash due to invalid memory access.
Brecht Van Lommel
brechtvanlommel at pandora.be
Fri May 4 11:25:09 CEST 2012
Revision: 46264
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46264
Author: blendix
Date: 2012-05-04 09:25:09 +0000 (Fri, 04 May 2012)
Log Message:
-----------
Fix #31286: saving 16 bit BW tiff could crash due to invalid memory access. Also
found that 16 bit RGBA saving was not working, fixed as well.
Modified Paths:
--------------
trunk/blender/source/blender/imbuf/intern/tiff.c
Modified: trunk/blender/source/blender/imbuf/intern/tiff.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/tiff.c 2012-05-04 09:20:54 UTC (rev 46263)
+++ trunk/blender/source/blender/imbuf/intern/tiff.c 2012-05-04 09:25:09 UTC (rev 46264)
@@ -778,22 +778,17 @@
if (pixels16) {
/* convert from float source */
- float rgb[3];
+ float rgb[4];
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]);
else
copy_v3_v3(rgb, &fromf[from_i]);
- to16[to_i+0] = FTOUSHORT(rgb[0]);
- to16[to_i+1] = FTOUSHORT(rgb[1]);
- to16[to_i+2] = FTOUSHORT(rgb[2]);
- to_i += 3; from_i+=3;
-
- if (samplesperpixel == 4) {
- to16[to_i+3] = FTOUSHORT(fromf[from_i+3]);
- /*to_i++; from_i++;*/ /*unused, set on each loop */
- }
+ rgb[3] = fromf[from_i+3];
+
+ for (i = 0; i < samplesperpixel; i++, to_i++)
+ to16[to_i] = FTOUSHORT(rgb[i]);
}
else {
for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
More information about the Bf-blender-cvs
mailing list