Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArraySliceType::copyForLocation assertion failure #8265

Closed
agroce opened this issue Feb 8, 2020 · 3 comments · Fixed by #9027
Closed

ArraySliceType::copyForLocation assertion failure #8265

agroce opened this issue Feb 8, 2020 · 3 comments · Fixed by #9027
Assignees
Labels

Comments

@agroce
Copy link

agroce commented Feb 8, 2020

Description

This contract:

contract C {
    function f( bytes calldata x,bool cond) external pure {
        bytes1 a = x[cond - 1 : 2]. a;
	if (0==1)
	    if (0<1)
		continue;
    }
}

produces:

Internal compiler error during compilation:
/home/user/solidity/libsolidity/ast/Types.h(797): Throw in function virtual std::unique_ptr<ReferenceType> solidity::frontend::ArraySliceType::copyForLocation(solidity::frontend::DataLocation, bool) const
Dynamic exception type: boost::exception_detail::clone_impl<solidity::langutil::InternalCompilerError>
std::exception::what: 
[solidity::util::tag_comment*] = 

when compiled.

On master, using AFL fuzzing. This was found with a new approach, that inlines a generic C-like source code mutation tool as a high-probability AFL havoc mutator.

Environment

  • Compiler version: 0.6.3-develop.2020.2.5+commit.f44188ab.Linux.clang
  • Target EVM version (as per compiler settings): N/A
  • Framework/IDE (e.g. Truffle or Remix): N/A
  • EVM execution environment / backend / blockchain client: N/A
  • Operating system: Ubuntu 18.04 in docker

Steps to Reproduce

Save this contract in shrink.sol (or whatever filename)

contract C {
    function f( bytes calldata x,bool cond) external pure {
        bytes1 a = x[cond - 1 : 2]. a;
	if (0==1)
	    if (0<1)
		continue;
    }
}

produces:

> solc shrink.sol 
Internal compiler error during compilation:
/home/user/solidity/libsolidity/ast/Types.h(797): Throw in function virtual std::unique_ptr<ReferenceType> solidity::frontend::ArraySliceType::copyForLocation(solidity::frontend::DataLocation, bool) const
Dynamic exception type: boost::exception_detail::clone_impl<solidity::langutil::InternalCompilerError>
std::exception::what: 
[solidity::util::tag_comment*] = 
@chriseth
Copy link
Contributor

Might be related to the other calldata storage location works we are doing.

@chriseth chriseth changed the title Throw in function virtual std::unique_ptr<ReferenceType> solidity::frontend::ArraySliceType::copyForLocation(solidity::frontend::DataLocation, bool) const Dynamic exception type: boost::exception_detail::clone_impl<solidity::langutil::InternalCompilerError> ArraySliceType::copyForLocation assertion failure Feb 10, 2020
@axic
Copy link
Member

axic commented May 7, 2020

Still in issue on today's develop.

@Marenz Marenz self-assigned this May 26, 2020
@Marenz
Copy link
Contributor

Marenz commented May 26, 2020

Reduced testcase:

contract C {
    function f(uint[2] calldata x) external pure {
        x[1:2]. a;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants