| 724 | } |
| 725 | |
| 726 | void State::copyUBFrom(const BasicBlock &bb) { |
| 727 | if (config::disallow_ub_exploitation) |
| 728 | return; |
| 729 | |
| 730 | // Time-travel UB: anything that happens before a possibly non-returning call |
| 731 | // can be moved up to the entry of the BB. |
| 732 | const Value *before_call = nullptr; |
| 733 | for (auto &i : bb.instrs()) { |
| 734 | if (auto *call = dynamic_cast<const FnCall*>(&i)) { |
| 735 | if (!call->hasAttribute(FnAttrs::WillReturn)) |
| 736 | break; |
| 737 | } |
| 738 | before_call = &i; |
| 739 | } |
| 740 | if (!before_call) |
| 741 | return; |
| 742 | |
| 743 | auto src_val_I = src_state->values.find(before_call); |
| 744 | assert(src_val_I != src_state->values.end()); |
| 745 | domain.UB.add(src_val_I->second.domain); |
| 746 | } |
| 747 | |
| 748 | void State::copyUBFromBB( |
| 749 | const unordered_map<const BasicBlock*, BasicBlockInfo> &tgt_data) { |
nothing calls this directly
no test coverage detected