@@ -4356,8 +4356,30 @@ tests = testGroup "hevm"
4356
4356
assertEqualM " We must be able to remove all duplicates" (length $ nubOrd simp) (length $ List. nub simp)
4357
4357
]
4358
4358
, testGroup " calling-solvers"
4359
- [
4360
- testCase " correct-model-for-empty-buffer" $ runEnv (testEnv {config = testEnv. config {numCexFuzz = 0 }}) $ do
4359
+ [ test " no-error-on-large-buf" $ do
4360
+ -- These two tests generates a very large buffer that previously would cause an internalError when
4361
+ -- printed via "formatCex". We should be able to print it now.
4362
+ Just c <- solcRuntime " MyContract" [i |
4363
+ contract MyContract {
4364
+ function fun(bytes calldata a) external pure {
4365
+ if (a.length > 0x800000000000) {
4366
+ assert(false);
4367
+ }
4368
+ }
4369
+ } |]
4370
+ (_, [Cex cex]) <- withDefaultSolver $ \ s -> checkAssert s defaultPanicCodes c Nothing [] defaultVeriOpts
4371
+ putStrLnM $ " Cex found:" <> T. unpack (formatCex (AbstractBuf " txdata" ) Nothing (snd cex))
4372
+ , test " no-error-on-large-buf-pure-print" $ do
4373
+ let bufs = Map. singleton (AbstractBuf " txdata" )
4374
+ (EVM.Types. Comp Write {byte = 1 , idx = 0x27 , next = Base {byte = 0x66 , length = 0xffff000000000000000 }})
4375
+ let mycex = SMTCex {vars = mempty
4376
+ , addrs = mempty
4377
+ , buffers = bufs
4378
+ , store = mempty
4379
+ , blockContext = mempty
4380
+ , txContext = Map. fromList [(TxValue ,0x0 )]}
4381
+ putStrLnM $ " Cex found:" <> T. unpack (formatCex (AbstractBuf " txdata" ) Nothing mycex)
4382
+ , testCase " correct-model-for-empty-buffer" $ runEnv (testEnv {config = testEnv. config {numCexFuzz = 0 }}) $ do
4361
4383
withDefaultSolver $ \ s -> do
4362
4384
let props = [(PEq (BufLength (AbstractBuf " b" )) (Lit 0x0 ))]
4363
4385
(res, _) <- checkSatWithProps s props
0 commit comments