Skip to content

Commit

Permalink
Fix bug in manager.tz parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonored committed Dec 9, 2019
1 parent d808272 commit edb5126
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/operations.c
Expand Up @@ -314,9 +314,9 @@ static inline bool parse_byte(
#define OP_JMPIF(step, cond) if(cond) { state->op_step=step; return true; }

// Shortcuts for defining literal-matching states; mostly used for contract-call boilerplate.
#define OP_STEP_REQUIRE_SHORT(constant) { uint16_t val = MICHELSON_READ_SHORT; if(val != constant) PARSE_ERROR(); } OP_STEP
#define OP_STEP_REQUIRE_BYTE(constant) { if(byte != constant) PARSE_ERROR(); } OP_STEP
#define OP_STEP_REQUIRE_LENGTH(constant) { uint32_t val = MICHELSON_READ_LENGTH; if(val != constant) PARSE_ERROR(); } OP_STEP
#define OP_STEP_REQUIRE_SHORT(constant) { uint16_t val = MICHELSON_READ_SHORT; if(val != constant) { PRINTF("Expected: %d, got: %d\n", constant, val); PARSE_ERROR(); } } OP_STEP
#define OP_STEP_REQUIRE_BYTE(constant) { if(byte != constant) { PRINTF("Expected: %d, got: %d\n", constant, byte); PARSE_ERROR(); } } OP_STEP
#define OP_STEP_REQUIRE_LENGTH(constant) { uint32_t val = MICHELSON_READ_LENGTH; if(val != constant) { PARSE_ERROR(); } } OP_STEP

switch(state->op_step) {

Expand Down Expand Up @@ -560,10 +560,12 @@ static inline bool parse_byte(
state->argument_length = MICHELSON_READ_LENGTH;
}

OP_STEP

// Error on anything but a michelson sequence.
OP_STEP_REQUIRE_BYTE(MICHELSON_TYPE_SEQUENCE);

OP_STEP {
{
const uint32_t sequence_length = MICHELSON_READ_LENGTH;

// Only allow single sequence (5 is needed
Expand Down

0 comments on commit edb5126

Please sign in to comment.