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

Add fix for matchBytes32Prefix #24

Merged
merged 4 commits into from
Dec 5, 2017
Merged

Conversation

marcogiglio
Copy link
Contributor

This PR fixes a mistake in matchBytes32Prefix, in both the new API version and the old one.
matchBytes32Prefix verify if the string sends by Oraclize as the result parameter of the callback is the SHA256 of the signature. Unfortunately, the comparison between the two byte arrays takes as a parameter the lenght of the string result, which is controlled by Oraclize. Therefore, it could be possible for the proof verification to pass even in the case Oraclize is returning an empty string in the callback.

If you see a more efficient way to do this, please suggest. Unfortunately, I was limited by the stack depth and I add to change the oraclize_randomDS_proofVerify__main to reduce the number of variables.

@bertani
Copy link
Contributor

bertani commented Dec 5, 2017

LGTM

@marcogiglio marcogiglio merged commit 5efc5a8 into master Dec 5, 2017

for (var i=0; i<prefix.length; i++){
for (var i=0; i< n_random_bytes; i++) {
Copy link
Contributor

@D-Nice D-Nice Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if n_random_bytes exceeds 255, this loop will overflow, consider using uint256 over var, if there's no other overflow or length checks on n_random_bytes

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

Successfully merging this pull request may close these issues.

3 participants