Skip to content

Commit

Permalink
[inferhack] test showing FP in uninitialised constants
Browse files Browse the repository at this point in the history
Reviewed By: davidpichardie

Differential Revision:
D62766490

Privacy Context Container: L1208441

fbshipit-source-id: 53d866a310a7c27c6cc6424c259c52f713109be9
  • Loading branch information
Nick Benton authored and facebook-github-bot committed Sep 18, 2024
1 parent c1bd05a commit 253d7a2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions infer/tests/codetoanalyze/hack/pulse/abstractconstants.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

// check we resolve constants in the right order

namespace AbstractConstants;

abstract class C {
abstract const int MyC;
}

interface I {
const int MyC = 1;
}

trait T {
const int MyC = 2;
}

class D extends C implements I {

}

class E extends C {
use T;
}

class Tester {
public static function constant_from_interface_FP(): void {
D::MyC;
}

public static function constant_from_trait_OK(): void {
E::MyC;
}
}
1 change: 1 addition & 0 deletions infer/tests/codetoanalyze/hack/pulse/issues.exp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
abstractconstants.hack, AbstractConstants::Tester$static.constant_from_interface_FP, 1, PULSE_UNINITIALIZED_CONST, no_bucket, ERROR, [global variable `AbstractConstants::C$static` accessed here,read to uninitialized value occurs here]
aliases.hack, Aliases::C.testAliasedShapeReturnBad, 3, PULSE_UNAWAITED_AWAITABLE, no_bucket, ERROR, [allocation part of the trace starts here,allocated by async call here,awaitable becomes unreachable here]
aliases.hack, Aliases::C.testParameterAliasOK_FP, 5, PULSE_UNAWAITED_AWAITABLE, no_bucket, ERROR, [allocation part of the trace starts here,allocated by async call here,awaitable becomes unreachable here]
arg_index_matcher.hack, Main.staticSink, 2, TAINT_ERROR, no_bucket, ERROR, [in call to `ArgIndexMatcher$static.source`,source of the taint here: value returned from `$root.Level1::taintSource` with kind `Simple`,return from call to `ArgIndexMatcher$static.source`,flows to this sink: value passed as argument `#1` to `ArgIndexMatcher$static.sink1` with kind `Simple`], source: $root.Level1::taintSource, sink: ArgIndexMatcher$static.sink1, tainted expression: $tainted
Expand Down

0 comments on commit 253d7a2

Please sign in to comment.