(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c) |
| |
| 1991 | | | vnc_tight_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset, |
| 1992 | | | proto_tree *tree, guint16 width, guint16 height) |
| 1993 | | | { |
| 1994 | | | vnc_packet_t *per_packet_info; |
| 1995 | | | guint8 comp_ctl; |
| 1996 | | | proto_item *compression_type_ti; |
| 1997 | | | gint bit_offset; |
| 1998 | | | gint bytes_needed = -1; |
| 1999 | | | |
| 2000 | | | |
| 2001 | | | (void) width; |
| 2002 | | | (void) height; |
| 2003 | | | |
| 2004 | | | per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc); |
Ignored Return Value
The return value of p_get_proto_data() is never checked in the highlighted execution scenario. - If the return value can indicate an error, the error will be ignored if the highlighted code executes.
- The return value of p_get_proto_data() is checked 97% of the time in this project. CodeSonar is configured to enforce Ignored Return Value checks for any function whose return value is checked at least 96% of the time, unless the function is used fewer than 20 times. (To modify these thresholds, use configuration file parameters RETURN_CHECKER_SAMPLE_SIZE and RETURN_CHECKER_RATIO. To exempt p_get_proto_data() from the Ignored Return Value check, use configuration file parameter RETURN_CHECKER_IGNORED_FUNCS).
Show: All events | Only primary events |
|
| 2005 | | | |
| 2006 | | | |
| 2007 | | | |
| 2008 | | | VNC_BYTES_NEEDED(1);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c |
| |
295 | #define VNC_BYTES_NEEDED(a) \ |
296 | if(a > (guint)tvb_length_remaining(tvb, *offset)) \ |
297 | return a; |
| |
|
Event 2:
Taking true branch. 1 > (guint)tvb_length_remaining(...) evaluates to true.
hide
|
|
| 2009 | | | |
| 2010 | | | |
| 2011 | | | bit_offset = *offset * 8; |
| 2012 | | | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream0, tvb, bit_offset + 7, 1, FALSE); |
| 2013 | | | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream1, tvb, bit_offset + 6, 1, FALSE); |
| 2014 | | | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream2, tvb, bit_offset + 5, 1, FALSE); |
| 2015 | | | proto_tree_add_bits_item(tree, hf_vnc_tight_reset_stream3, tvb, bit_offset + 4, 1, FALSE); |
| 2016 | | | |
| 2017 | | | |
| 2018 | | | compression_type_ti = proto_tree_add_bits_item(tree, hf_vnc_tight_rect_type, tvb, bit_offset + 0, 4, FALSE); |
| 2019 | | | |
| 2020 | | | comp_ctl = tvb_get_guint8(tvb, *offset); |
| 2021 | | | *offset += 1; |
| 2022 | | | |
| 2023 | | | comp_ctl >>= 4; |
| 2024 | | | |
| 2025 | | | |
| 2026 | | | |
| 2027 | | | if (comp_ctl == TIGHT_RECT_FILL) { |
| 2028 | | | |
| 2029 | | | |
| 2030 | | | proto_item_append_text(compression_type_ti, " (fill encoding - solid rectangle)"); |
| 2031 | | | |
| 2032 | | | if (per_packet_info->depth == 24) { |
| 2033 | | | VNC_BYTES_NEEDED(3);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c |
| |
295 | #define VNC_BYTES_NEEDED(a) \ |
296 | if(a > (guint)tvb_length_remaining(tvb, *offset)) \ |
297 | return a; |
| |
|
| 2034 | | | proto_tree_add_item(tree, hf_vnc_tight_fill_color, tvb, *offset, 3, FALSE); |
| 2035 | | | *offset += 3; |
| 2036 | | | } else { |
| 2037 | | | VNC_BYTES_NEEDED(per_packet_info->bytes_per_pixel);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c |
| |
295 | #define VNC_BYTES_NEEDED(a) \ |
296 | if(a > (guint)tvb_length_remaining(tvb, *offset)) \ |
297 | return a; |
| |
|
| 2038 | | | proto_tree_add_item(tree, hf_vnc_tight_fill_color, tvb, *offset, per_packet_info->bytes_per_pixel, FALSE); |
| 2039 | | | *offset += per_packet_info->bytes_per_pixel; |
| 2040 | | | } |
| 2041 | | | |
| 2042 | | | bytes_needed = 0; |
| 2043 | | | } else if (comp_ctl == TIGHT_RECT_JPEG) { |
| 2044 | | | |
| 2045 | | | |
| 2046 | | | proto_item_append_text(compression_type_ti, " (JPEG encoding)"); |
| 2047 | | | bytes_needed = process_compact_length_and_image_data(tvb, offset, tree); |
| 2048 | | | if (bytes_needed != 0) |
| 2049 | | | return bytes_needed; |
| 2050 | | | } else if (comp_ctl > TIGHT_RECT_MAX_VALUE) { |
| 2051 | | | |
| 2052 | | | |
| 2053 | | | proto_item_append_text(compression_type_ti, " (invalid encoding)"); |
| 2054 | | | DISSECTOR_ASSERT_NOT_REACHED();
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
131 | #define DISSECTOR_ASSERT_NOT_REACHED() \ |
132 | (REPORT_DISSECTOR_BUG( \ |
133 | ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \ |
134 | __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 2055 | | | } else { |
| 2056 | | | guint row_size; |
| 2057 | | | gint bits_per_pixel; |
| 2058 | | | |
| 2059 | | | |
| 2060 | | | |
| 2061 | | | proto_item_append_text(compression_type_ti, " (basic encoding)"); |
| 2062 | | | |
| 2063 | | | proto_tree_add_bits_item(tree, hf_vnc_tight_filter_flag, tvb, bit_offset + 1, 1, FALSE); |
| 2064 | | | |
| 2065 | | | bits_per_pixel = per_packet_info->depth; |
| 2066 | | | |
| 2067 | | | if ((comp_ctl & TIGHT_RECT_EXPLICIT_FILTER_FLAG) != 0) { |
| 2068 | | | guint8 filter_id; |
| 2069 | | | |
| 2070 | | | |
| 2071 | | | |
| 2072 | | | VNC_BYTES_NEEDED(1);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c |
| |
295 | #define VNC_BYTES_NEEDED(a) \ |
296 | if(a > (guint)tvb_length_remaining(tvb, *offset)) \ |
297 | return a; |
| |
|
| 2073 | | | proto_tree_add_item(tree, hf_vnc_tight_filter_id, tvb, *offset, 1, FALSE); |
| 2074 | | | filter_id = tvb_get_guint8(tvb, *offset); |
| 2075 | | | *offset += 1; |
| 2076 | | | |
| 2077 | | | switch (filter_id) { |
| 2078 | | | case TIGHT_RECT_FILTER_COPY: |
| 2079 | | | |
| 2080 | | | break; |
| 2081 | | | |
| 2082 | | | case TIGHT_RECT_FILTER_PALETTE: |
| 2083 | | | bytes_needed = process_tight_rect_filter_palette(tvb, pinfo, offset, tree, &bits_per_pixel); |
| 2084 | | | if (bytes_needed != 0) |
| 2085 | | | return bytes_needed; |
| 2086 | | | |
| 2087 | | | break; |
| 2088 | | | |
| 2089 | | | case TIGHT_RECT_FILTER_GRADIENT: |
| 2090 | | | |
| 2091 | | | break; |
| 2092 | | | } |
| 2093 | | | } else { |
| 2094 | | | |
| 2095 | | | } |
| 2096 | | | |
| 2097 | | | row_size = ((guint) width * bits_per_pixel + 7) / 8; |
| 2098 | | | if (row_size * height < TIGHT_MIN_BYTES_TO_COMPRESS) { |
| 2099 | | | guint num_bytes; |
| 2100 | | | |
| 2101 | | | |
| 2102 | | | |
| 2103 | | | num_bytes = row_size * height; |
| 2104 | | | VNC_BYTES_NEEDED(num_bytes);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c |
| |
295 | #define VNC_BYTES_NEEDED(a) \ |
296 | if(a > (guint)tvb_length_remaining(tvb, *offset)) \ |
297 | return a; |
| |
|
| 2105 | | | proto_tree_add_item(tree, hf_vnc_tight_image_data, tvb, *offset, num_bytes, FALSE); |
| 2106 | | | *offset += num_bytes; |
| 2107 | | | |
| 2108 | | | bytes_needed = 0; |
| 2109 | | | } else { |
| 2110 | | | |
| 2111 | | | bytes_needed = process_compact_length_and_image_data(tvb, offset, tree); |
| 2112 | | | if (bytes_needed != 0) |
| 2113 | | | return bytes_needed; |
| 2114 | | | } |
| 2115 | | | } |
| 2116 | | | |
| 2117 | | | DISSECTOR_ASSERT(bytes_needed != -1);
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
117 | #define DISSECTOR_ASSERT(expression) \ |
118 | ((void) ((expression) ? (void)0 : \ |
119 | __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
138 | #define __DISSECTOR_ASSERT(expression, file, lineno) \ |
139 | (REPORT_DISSECTOR_BUG( \ |
140 | ep_strdup_printf("%s:%u: failed assertion \"%s\"", \ |
141 | file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression)))) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/proto.h |
| |
106 | #define REPORT_DISSECTOR_BUG(message) \ |
107 | ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \ |
108 | abort() : \ |
109 | THROW_MESSAGE(DissectorError, message)) |
| |
x /home/sate/Testcases/c/cve/wireshark-1.2.0/epan/exceptions.h |
| |
226 | #define THROW_MESSAGE(x, y) \ |
227 | except_throw(XCEPT_GROUP_WIRESHARK, (x), (y)) |
| |
|
| 2118 | | | |
| 2119 | | | return bytes_needed; |
| 2120 | | | } |
| |