Skip to content

Commit 2bc5e8d

Browse files
committed
Check if transaction is created on new tainted string (#44)
1 parent 4310831 commit 2bc5e8d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/api/string_methods.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ void NewTaintedString(const FunctionCallbackInfo<Value>& args) {
8282

8383
try {
8484
auto transaction = NewTransaction(transactionId);
85+
if (transaction == nullptr) {
86+
return;
87+
}
8588
auto taintedObj = transaction->FindTaintedObject(utils::GetLocalStringPointer(parameterValue));
8689
if (taintedObj) {
8790
// Object already exist, nothing to do

test/js/new_tainted_string.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ describe('Taint strings', function () {
110110
})
111111
})
112112

113+
it('Beyond max concurrent transactions', function () {
114+
const MAX_TRANSACTION_MAP_SIZE = 2
115+
const transactions = []
116+
for (let i = 1; i < MAX_TRANSACTION_MAP_SIZE + 1; i++) {
117+
transactions[i] = TaintedUtils.createTransaction(`beyondTest${i}`)
118+
TaintedUtils.newTaintedString(transactions[i], `taintedString${i}`, 'param', 'request')
119+
}
120+
121+
transactions.forEach((transactionId) => TaintedUtils.removeTransaction(transactionId))
122+
})
123+
113124
it('Beyond Max values', function () {
114125
let ret
115126
// let id = '1';

0 commit comments

Comments
 (0)