Skip to content

Commit c8fd4dc

Browse files
committed
Revert "Merge pull request intel#146 from dawagner/criterion-overflow-check"
This reverts commit 12227ef, reversing changes made to 1f14d4b.
1 parent 12227ef commit c8fd4dc

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

parameter/SelectionCriterionType.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2014, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -30,8 +30,6 @@
3030
#include "SelectionCriterionType.h"
3131
#include "Tokenizer.h"
3232

33-
#include <climits>
34-
3533
#define base CElement
3634

3735
const std::string CSelectionCriterionType::_strDelimiter = "|";
@@ -53,18 +51,6 @@ std::string CSelectionCriterionType::getKind() const
5351
// From ISelectionCriterionTypeInterface
5452
bool CSelectionCriterionType::addValuePair(int iValue, const std::string& strValue)
5553
{
56-
// An inclusive criterion is implemented as a bitfield over an int and
57-
// thus, can't have values larger than the number of bits in an int.
58-
static const unsigned int inclusiveCriterionMaxValue = 1 << (sizeof(iValue) * CHAR_BIT - 1);
59-
60-
if (_bInclusive && (unsigned int)iValue > inclusiveCriterionMaxValue) {
61-
62-
log_warning("Rejecting value pair association: 0x%X - %s "
63-
"because an inclusive criterion can't have values larger than 0x%X",
64-
iValue, strValue.c_str(), inclusiveCriterionMaxValue);
65-
return false;
66-
}
67-
6854
// Check 1 bit set only for inclusive types
6955
if (_bInclusive && (!iValue || (iValue & (iValue - 1)))) {
7056

test/test-platform/TestPlatform.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011-2015, Intel Corporation
2+
* Copyright (c) 2011-2014, Intel Corporation
33
* All rights reserved.
44
*
55
* Redistribution and use in source and binary forms, with or without modification,
@@ -333,6 +333,14 @@ bool CTestPlatform::createInclusiveSelectionCriterionFromStateList(
333333
assert(pCriterionType != NULL);
334334

335335
uint32_t uiNbStates = remoteCommand.getArgumentCount() - 1;
336+
337+
if (uiNbStates > 32) {
338+
339+
strResult = "Maximum number of states for inclusive criterion is 32";
340+
341+
return false;
342+
}
343+
336344
uint32_t uiState;
337345

338346
for (uiState = 0; uiState < uiNbStates; uiState++) {
@@ -389,6 +397,13 @@ bool CTestPlatform::createInclusiveSelectionCriterion(const string& strName,
389397
ISelectionCriterionTypeInterface* pCriterionType =
390398
_pParameterMgrPlatformConnector->createSelectionCriterionType(true);
391399

400+
if (uiNbStates > 32) {
401+
402+
strResult = "Maximum number of states for inclusive criterion is 32";
403+
404+
return false;
405+
}
406+
392407
uint32_t uiState;
393408

394409
for (uiState = 0; uiState < uiNbStates; uiState++) {

0 commit comments

Comments
 (0)