You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Used to register a taint, or to fetch the ID of an already registered taint by its alias.
363
+
*
364
+
* @throws AssertionError if no more taint slots are left
365
+
* @throws RuntimeException if the passed alias uses some unregistered taint slots
366
+
* @param ?int $alias Used to register an alias of one or more pre-existing taints.
367
+
*/
368
+
publicfunctiongetOrRegisterTaint(string$taint_type, ?int$alias = null): int
369
+
{
370
+
if (isset($this->taint_map[$taint_type])) {
371
+
return$this->taint_map[$taint_type];
372
+
}
373
+
if ($alias === null) {
374
+
if ($this->taint_count+1 === (PHP_INT_SIZE * 8)) {
375
+
if (PHP_INT_SIZE === 8) {
376
+
thrownewRuntimeException("No more taint slots left, please register fewer taints or use some of the built-in taints!");
377
+
}
378
+
thrownewRuntimeException("No more taint slots left, please switch to a 64-bit build of PHP to get 32 more taint slots, or register fewer taints or use some of the built-in taints!");
379
+
}
380
+
$id = 1 << ($this->taint_count++);
381
+
$this->custom_taints[$id] + $taint_type;
382
+
} else {
383
+
if ($this->taint_count+1 !== (PHP_INT_SIZE * 8)) {
384
+
$mask = (1 << $this->taint_count) - 1;
385
+
if ($alias & ~$mask) {
386
+
thrownewAssertionError("The passed alias $alias uses some not yet registered taint slots!");
387
+
}
388
+
}
389
+
$id = $alias;
390
+
}
391
+
$this->taint_map[$taint_type] = $id;
392
+
return$id;
393
+
}
394
+
395
+
/**
396
+
* Used to to fetch the ID of an already registered taint by its alias, or null if no taint is registered for the alias.
397
+
*/
398
+
publicfunctiongetTaint(string$taint_type): ?int
399
+
{
400
+
return$this->taint_map[$taint_type] ?? null;
401
+
}
402
+
322
403
privatefunctionloadAnalyzer(): void
323
404
{
324
405
$this->analyzer = newAnalyzer(
@@ -2145,7 +2226,7 @@ public function queueClassLikeForScanning(
2145
2226
publicfunctionaddTaintSource(
2146
2227
Union$expr_type,
2147
2228
string$taint_id,
2148
-
int$taints = TaintKindGroup::ALL_INPUT,
2229
+
int$taints = TaintKind::ALL_INPUT,
2149
2230
?CodeLocation$code_location = null,
2150
2231
): Union {
2151
2232
if (!$this->taint_flow_graph) {
@@ -2167,7 +2248,7 @@ public function addTaintSource(
0 commit comments