summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2009-11-20 18:59:03 +0000
committerscuri <scuri>2009-11-20 18:59:03 +0000
commit9cc6fd6da62bc239bf22ced6ae24c0ffdd994b40 (patch)
treef91ec6d46895ec1e00fc31927a5c923b65f22fbd
parentd74811ae84f8caebf287eb2fd4cc799fc7dbcee2 (diff)
* Fixed: invalid memory access in imAnalyzeFindRegions when more than 16k regions where found.
-rw-r--r--html/en/history.html7
-rw-r--r--src/process/im_analyze.cpp11
2 files changed, 12 insertions, 6 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 6cb8dd1..fdf2b46 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -12,6 +12,13 @@
<h2>History of Changes</h2>
<h3 dir="ltr">
+ CVS (20/11/2009</h3>
+<ul dir="ltr">
+ <li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
+ style="color: #000000"> invalid memory access in <strong>
+ imAnalyzeFindRegions</strong> when more than 16k regions where found.</span></span></li>
+</ul>
+<h3 dir="ltr">
<a href="http://sourceforge.net/projects/imtoolkit/files/3.5/">Version 3.5</a> (02/Oct/2009)</h3>
<ul>
<li><span style="color: #0000FF">New:</span> functions <strong>
diff --git a/src/process/im_analyze.cpp b/src/process/im_analyze.cpp
index 6fa9405..02748f0 100644
--- a/src/process/im_analyze.cpp
+++ b/src/process/im_analyze.cpp
@@ -2,7 +2,7 @@
* \brief Image Analysis
*
* See Copyright Notice in im_lib.h
- * $Id: im_analyze.cpp,v 1.2 2009/09/28 20:19:09 scuri Exp $
+ * $Id: im_analyze.cpp,v 1.3 2009/11/20 18:59:08 scuri Exp $
*/
@@ -139,7 +139,7 @@ static int DoAnalyzeFindRegions(int width, int height, imbyte* map, imushort* ne
int region_count = 2; // 0- background, 1-border
imushort* alias_table = new imushort [MAX_COUNT];
- memset(alias_table, 0, MAX_COUNT); // aliases are all zero at start (not used)
+ memset(alias_table, 0, MAX_COUNT*sizeof(imushort)); // aliases are all zero at start (not used)
for (i = 1; i < height; i++)
{
@@ -273,7 +273,7 @@ static int DoAnalyzeFindRegionsBorder(int width, int height, imbyte* map, imusho
int region_count = 2; // still consider: 0- background, 1-border
imushort* alias_table = new imushort [MAX_COUNT];
- memset(alias_table, 0, MAX_COUNT); // aliases are all zero at start (not used)
+ memset(alias_table, 0, MAX_COUNT*sizeof(imushort)); // aliases are all zero at start (not used)
for (i = 0; i < height; i++)
{
@@ -402,8 +402,7 @@ int imAnalyzeFindRegions(const imImage* image, imImage* NewImage, int connect, i
void imAnalyzeMeasureArea(const imImage* image, int* data_area, int region_count)
{
imushort* img_data = (imushort*)image->data[0];
-
- memset(data_area, 0, region_count*sizeof(int));
+ memset(data_area, 0, region_count*sizeof(imushort));
for (int i = 0; i < image->count; i++)
{
@@ -981,7 +980,7 @@ void imAnalyzeMeasurePerimeter(const imImage* image, float* perim_data, int regi
imushort* map = (imushort*)image->data[0];
- memset(perim_data, 0, region_count*sizeof(int));
+ memset(perim_data, 0, region_count*sizeof(float));
int width = image->width;
int height = image->height;