[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50238] trunk/blender/source/blender/ editors/space_sequencer/sequencer_scopes.c: Sequencer: fix crash of histogram view for float images

Sergey Sharybin sergey.vfx at gmail.com
Mon Aug 27 11:01:34 CEST 2012


Revision: 50238
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50238
Author:   nazgul
Date:     2012-08-27 09:01:34 +0000 (Mon, 27 Aug 2012)
Log Message:
-----------
Sequencer: fix crash of histogram view for float images

Overexposured pixels lead to wrong memory access in histogram making function

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c

Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c	2012-08-27 08:28:29 UTC (rev 50237)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_scopes.c	2012-08-27 09:01:34 UTC (rev 50238)
@@ -470,7 +470,7 @@
 
 	unsigned int bins[3][256];
 
-	memset(bins, 0, 3 * 256 * sizeof(unsigned int));
+	memset(bins, 0, sizeof(bins));
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {
@@ -507,10 +507,10 @@
 static int get_bin_float(float f)
 {
 	if (f < -0.25f) {
-		f = -0.25f;
+		return 0;
 	}
-	else if (f > 1.25f) {
-		f = 1.25f;
+	else if (f >= 1.25f) {
+		return 511;
 	}
 
 	return (int) (((f + 0.25f) / 1.5f) * 512);
@@ -524,7 +524,7 @@
 
 	unsigned int bins[3][512];
 
-	memset(bins, 0, 3 * 256 * sizeof(unsigned int));
+	memset(bins, 0, sizeof(bins));
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {




More information about the Bf-blender-cvs mailing list