Skip to content

Commit

Permalink
Use safe add for offset functions
Browse files Browse the repository at this point in the history
  • Loading branch information
franklinsch committed Jun 9, 2018
1 parent f52c4bd commit c44e345
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/IRGen/Runtime/IULIARuntimeFunction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ struct IULIARuntimeFunctionDeclaration {
"""
function flint$storageFixedSizeArrayOffset(arrayOffset, index, arraySize) -> ret {
if flint$isInvalidSubscriptExpression(index, arraySize) { revert(0, 0) }
ret := add(arrayOffset, index)
ret := flint$add(arrayOffset, index)
}
"""

Expand All @@ -252,7 +252,7 @@ struct IULIARuntimeFunctionDeclaration {
if flint$isInvalidSubscriptExpression(index, arraySize) { revert(0, 0) }
}
default {
sstore(arrayOffset, add(arraySize, 1))
sstore(arrayOffset, flint$add(arraySize, 1))
}
ret := flint$storageDictionaryOffsetForKey(arrayOffset, index)
Expand Down

0 comments on commit c44e345

Please sign in to comment.