Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Add check for inclusive criterion overflow #146

Merged
merged 1 commit into from
Jul 13, 2015

Conversation

dawagner
Copy link
Contributor

@dawagner dawagner commented Jul 9, 2015

Inclusive criteria have a limited value number due to their internal state
representation. Currently, the only check made for this is at test-platform
level.

This patch adds a new check to make addValuePair API fail if too many values
are added to an inclusive criterion type. A log has also been added to warn
the client. The check at test-platform level has been removed.

Change-Id: Ie9c9ec8fb8561f949bb62adbab127bc900aa254b
Signed-off-by: Jules Clero [email protected]

@dawagner dawagner added the bug label Jul 9, 2015
@dawagner
Copy link
Contributor Author

dawagner commented Jul 9, 2015

@krocard @cc6565 please review.

@dawagner dawagner force-pushed the criterion-overflow-check branch from 1905cba to 982e7a5 Compare July 9, 2015 15:30
Inclusive criteria have a limited value number due to their internal state
representation. Currently, the only check made for this is at test-platform
level.

This patch adds a new check to make addValuePair API fail if values too large
are added to an inclusive criterion type.  A log has also been added to warn
the client.  The check at test-platform level has been removed.

Change-Id: Ie9c9ec8fb8561f949bb62adbab127bc900aa254b
Signed-off-by: Jules Clero <[email protected]>
dawagner added a commit that referenced this pull request Jul 13, 2015
Add check for inclusive criterion overflow

Inclusive criteria have a limited value number due to their internal state
representation. Currently, the only check made for this is at test-platform
level.

This patch adds a new check to make addValuePair API fail if too many values
are added to an inclusive criterion type. A log has also been added to warn
the client. The check at test-platform level has been removed.
@dawagner dawagner merged commit 12227ef into intel:master Jul 13, 2015
@dawagner dawagner deleted the criterion-overflow-check branch July 13, 2015 11:42
dawagner added a commit to dawagner/parameter-framework that referenced this pull request Jul 15, 2015
…-check"

This reverts commit 12227ef, reversing
changes made to 1f14d4b.
@dawagner dawagner restored the criterion-overflow-check branch July 15, 2015 09:23
@dawagner dawagner deleted the criterion-overflow-check branch July 15, 2015 09:25
@@ -51,6 +53,18 @@ std::string CSelectionCriterionType::getKind() const
// From ISelectionCriterionTypeInterface
bool CSelectionCriterionType::addValuePair(int iValue, const std::string& strValue)
{
// An inclusive criterion is implemented as a bitfield over an int and
// thus, can't have values larger than the number of bits in an int.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not correct. How about:

 /* 
 Inclusive criterion is implemented as a bitfield over an int.
 As such fitfield are usually constructed by shifting a bit, forbid the sign bit to be used.
 Shifting a bit over the sign bit returns in an overflow, which is an undefined behavior.

 This check is more educative than effective, as to be detected the overflow might have already happed.
 The client might have generated the value safely (by casting from unsigned), but this is considered unlikely.
 */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obsolete

mgaio pushed a commit to mgaio/parameter-framework that referenced this pull request Aug 19, 2015
…-check"

This reverts commit 12227ef, reversing
changes made to 1f14d4b.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants