Text   |  XML   |  ReML   |   Visible Warnings:

Ignored Return Value  at packet-vnc.c:2004

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

vnc_tight_encoding

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-vnc.c)expand/collapse
Show more  
 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          /* unused arguments */
 2001          (void) width;
 2002          (void) height;
 2003   
 2004          per_packet_info = p_get_proto_data(pinfo->fd, proto_vnc);
 2005   
 2006          /* See xserver/hw/vnc/rfbproto.h and grep for "Tight Encoding." for the following layout */
 2007   
 2008          VNC_BYTES_NEEDED(1);
 2009   
 2010          /* least significant bits 0-3 are "reset compression stream N" */
 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          /* most significant bits 4-7 are "compression type" */
 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; /* skip over the "reset compression" bits from above */
 2024   
 2025          /* compression format */
 2026   
 2027          if (comp_ctl == TIGHT_RECT_FILL) {
 2028                  /* "fill" encoding (solid rectangle) */
 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);
 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);
 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                  /* jpeg encoding */
 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                  /* invalid encoding */
 2052   
 2053                  proto_item_append_text(compression_type_ti, " (invalid encoding)");
 2054                  DISSECTOR_ASSERT_NOT_REACHED();
 2055          } else {
 2056                  guint row_size;
 2057                  gint bits_per_pixel;
 2058   
 2059                  /* basic encoding */
 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                          /* explicit filter */
 2071   
 2072                          VNC_BYTES_NEEDED(1);
 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                                  /* nothing to do */
 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                                  /* nothing to do */
 2091                                  break;
 2092                          }
 2093                  } else {
 2094                          /* this is the same case as TIGHT_RECT_FILTER_COPY, so there's nothing special to do */
 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                          /* The data is not compressed; just skip over it */
 2102   
 2103                          num_bytes = row_size * height;
 2104                          VNC_BYTES_NEEDED(num_bytes);
 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                          /* The data is compressed; read its length and data */
 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);
 2118   
 2119          return bytes_needed;
 2120  }
Show more  




Change Warning 5444.35668 : Ignored Return Value

Priority:
State:
Finding:
Owner:
Note: