From 49aec64cafd06bde9b0f3c46517bee3778531115 Mon Sep 17 00:00:00 2001 From: Bhargava Shastry Date: Thu, 12 Dec 2019 18:33:36 +0100 Subject: [PATCH] abiv2 proto converter: Do not resize dynamic storage arrays by writing to the length field as it is now read only --- test/tools/ossfuzz/protoToAbiV2.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/tools/ossfuzz/protoToAbiV2.cpp b/test/tools/ossfuzz/protoToAbiV2.cpp index b980a6f93..c7ac06c22 100644 --- a/test/tools/ossfuzz/protoToAbiV2.cpp +++ b/test/tools/ossfuzz/protoToAbiV2.cpp @@ -810,13 +810,16 @@ pair AssignCheckVisitor::visit(ArrayType const& _type) length = getDynArrayLengthFromFuzz(_type.length(), counter()); lengthStr = to_string(length); if (m_stateVar) - resizeBuffer = assignAndCheckStringPair( - m_varName + ".length", - m_paramName + ".length", - lengthStr, - lengthStr, - DataType::VALUE - ); + { + // Dynamic storage arrays are resized via the empty push() operation + resizeBuffer.first = Whiskers(R"(for (uint i = 0; i < ; i++) .push();)") + ("indentation", indentation()) + ("length", lengthStr) + ("arrayRef", m_varName) + .render() + "\n"; + // Add a dynamic check on the resized length + resizeBuffer.second = checkString(m_paramName + ".length", lengthStr, DataType::VALUE); + } else { // Resizing memory arrays via the new operator