OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000964OMNeT++simulation kernelpublic2016-07-15 08:572016-07-15 08:57
Assigned To 
Platformx86_64OSUbuntuOS Version16.04 (xenial)
Product Version5.0 
Target VersionFixed in Version 
Summary0000964: Integer saturation in when when input value range is very large
DescriptionWhen working with a custom PER calculation model, I found a bug within chistogram::setupRangeInteger ( line 333). The calculated PER value would exceed 1.0 by far, which would cause an integer overflow when calculating cellSize for non-fixed ranges. With a maximum recorded value of 2,32e+291 (long)ceil(rangeMax - rangeMin/200.0) would result in a negative value for numCels (0x8000000000000000), since (long) and not (unsigned long) is used.
This causes an error in cHistogram::transform() ( line 129):
cellv = new unsigned[numCells];
which results in: std::bad_array_new_length.

Changing the lines to cast to unsigned long instead, does not generate a negative value for numCells, but still results in std::bad_array_new_length. It seems as in this case some other limit is active.

It seems that a maximum or minimum check before the creation of the new array should be introduced avoiding the array creation failure.
Steps To Reproduce- Use histogram in integer mode
- record very large value
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2016-07-15 08:57 pfefferk New Issue

Copyright © 2000 - 2022 MantisBT Team
Powered by Mantis Bugtracker