Replace asserts with returns
* Changes to satisfy fuzzer
diff --git a/source/parsed_operand.cpp b/source/parsed_operand.cpp
index 3bb4dd0..7ad369c 100644
--- a/source/parsed_operand.cpp
+++ b/source/parsed_operand.cpp
@@ -23,10 +23,12 @@
void EmitNumericLiteral(std::ostream* out, const spv_parsed_instruction_t& inst,
const spv_parsed_operand_t& operand) {
- assert(operand.type == SPV_OPERAND_TYPE_LITERAL_INTEGER ||
- operand.type == SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER);
- assert(1 <= operand.num_words);
- assert(operand.num_words <= 2);
+ if (operand.type != SPV_OPERAND_TYPE_LITERAL_INTEGER &&
+ operand.type != SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER)
+ return;
+ if (operand.num_words < 1) return;
+ // TODO(dneto): Support more than 64-bits at a time.
+ if (operand.num_words > 2) return;
const uint32_t word = inst.words[operand.offset];
if (operand.num_words == 1) {
@@ -47,7 +49,7 @@
}
break;
default:
- assert(false && "Unreachable");
+ break;
}
} else if (operand.num_words == 2) {
// Multi-word numbers are presented with lower order words first.
@@ -65,11 +67,8 @@
*out << spvtools::utils::FloatProxy<double>(bits);
break;
default:
- assert(false && "Unreachable");
+ break;
}
- } else {
- // TODO(dneto): Support more than 64-bits at a time.
- assert(false && "Unhandled");
}
}
} // namespace spvtools