diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2016-02-19 19:37:15 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-02-21 22:44:00 +0000 |
commit | 5f8c555615b35508b0d8cbcec31d53f67331752a (patch) | |
tree | 0ff2723407f585f8434e8ce1d008b017c7271a32 | |
parent | 14881e72d63d25048464155c5e8cc43a51731b16 (diff) |
sigcomp: don't THROW() an exception from a dissector
when there's a decompression failure, we already flag up an expert info and exit
we can just delete the exception
in dissect_udvm_reference_operand_memory(), we return 0 on error and
let the caller do a check
Change-Id: I2cd301896794260457f57209e5efc0939b27b339
Reviewed-on: https://code.wireshark.org/review/14063
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-sigcomp.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c index bb977dfaf0..59b8505884 100644 --- a/epan/dissectors/packet-sigcomp.c +++ b/epan/dissectors/packet-sigcomp.c @@ -1399,7 +1399,7 @@ dissect_udvm_reference_operand_memory(guint8 *buff,guint operand_address, guint1 } if (offset >= UDVM_MEMORY_SIZE || *result_dest >= UDVM_MEMORY_SIZE - 1 ) - THROW(ReportedBoundsError); + return 0; return offset; } @@ -1988,6 +1988,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2030,6 +2032,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2072,6 +2076,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2105,6 +2111,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2146,6 +2154,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2186,6 +2196,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2226,6 +2238,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2267,6 +2281,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2315,6 +2331,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2365,6 +2383,8 @@ execute_next_instruction: /* $operand_1*/ operand_address = current_address + 1; next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &operand_1, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_operand_1, bytecode_tvb, offset, (next_operand_address-operand_address), operand_1, "Addr: %u operand_1 %u", operand_address, operand_1); @@ -2453,6 +2473,8 @@ execute_next_instruction: /* $destination */ next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &ref_destination, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (print_level_1 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_ref_dest, bytecode_tvb, offset, (next_operand_address-operand_address), ref_destination, "Addr: %u $destination %u", operand_address, ref_destination); @@ -2836,6 +2858,8 @@ execute_next_instruction: /* $destination */ next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &ref_destination, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_ref_dest, bytecode_tvb, offset, (next_operand_address-operand_address), ref_destination, "Addr: %u destination %u", operand_address, ref_destination); @@ -2932,6 +2956,8 @@ execute_next_instruction: /* $destination */ next_operand_address = dissect_udvm_reference_operand_memory(buff, operand_address, &ref_destination, &result_dest); + if (next_operand_address < operand_address) + goto decompression_failure; if (show_instr_detail_level == 2 ) { proto_tree_add_uint_format(udvm_tree, hf_udvm_ref_dest, bytecode_tvb, offset, (next_operand_address-operand_address), ref_destination, "Addr: %u $destination %u", operand_address, ref_destination); @@ -4401,7 +4427,6 @@ decompression_failure: proto_tree_add_expert_format(udvm_tree, pinfo, &ei_sigcomp_decompression_failure, bytecode_tvb, 0, -1, "DECOMPRESSION FAILURE: %s", val_to_str(result_code, result_code_vals,"Unknown (%u)")); g_free(out_buff); - THROW(ReportedBoundsError); return NULL; } |