diff options
author | scuri <scuri> | 2009-11-20 18:59:03 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-11-20 18:59:03 +0000 |
commit | 9cc6fd6da62bc239bf22ced6ae24c0ffdd994b40 (patch) | |
tree | f91ec6d46895ec1e00fc31927a5c923b65f22fbd /src | |
parent | d74811ae84f8caebf287eb2fd4cc799fc7dbcee2 (diff) |
* Fixed: invalid memory access in imAnalyzeFindRegions when more than 16k regions where found.
Diffstat (limited to 'src')
-rw-r--r-- | src/process/im_analyze.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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; |