Skip to content

Commit 774b182

Browse files
committed
ruby: also insert capturedExitRead-nodes by exceptional exits
1 parent 73bae16 commit 774b182

File tree

3 files changed

+1
-3
lines changed

3 files changed

+1
-3
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/SsaImpl.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ private predicate writesCapturedVariable(Cfg::BasicBlock bb, LocalVariable v) {
106106
* at index `i` in exit block `bb`.
107107
*/
108108
private predicate capturedExitRead(Cfg::AnnotatedExitBasicBlock bb, int i, LocalVariable v) {
109-
bb.isNormal() and
110109
writesCapturedVariable(bb.getAPredecessor*(), v) and
111110
i = bb.length()
112111
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
| DeadStoreOfLocal.rb:2:5:2:5 | y | This assignment to $@ is useless, since its value is never read. | DeadStoreOfLocal.rb:2:5:2:5 | y | y |
2-
| DeadStoreOfLocal.rb:61:17:61:17 | x | This assignment to $@ is useless, since its value is never read. | DeadStoreOfLocal.rb:56:17:56:17 | x | x |

ruby/ql/test/query-tests/variables/DeadStoreOfLocal/DeadStoreOfLocal.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_retried x
5858
print x
5959
if x < 1
6060
begin
61-
x += 1 #$ SPURIOUS: Alert
61+
x += 1 #$ OK - the block may be executed again
6262
raise StandardError
6363
end
6464
end

0 commit comments

Comments
 (0)