This repository has been archived by the owner on Aug 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
Add check for inclusive criterion overflow #146
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1905cba
to
982e7a5
Compare
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
added a commit
to dawagner/parameter-framework
that referenced
this pull request
Jul 15, 2015
@@ -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. |
There was a problem hiding this comment.
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.
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obsolete
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]