(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-evrc.c) |
| |
| 193 | | | dissect_evrc_aux(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, evrc_variant_t evrc_variant) |
| 194 | | | { |
| 195 | | | guint8 oct; |
| 196 | | | guint8 frame_count; |
| 197 | | | guint8 i; |
| 198 | | | guint32 offset, orig_offset, saved_offset; |
| 199 | | | gboolean further_entries; |
| 200 | | | guint32 len; |
| 201 | | | proto_item *item = NULL; |
| 202 | | | proto_tree *evrc_tree = NULL; |
| 203 | | | proto_tree *toc_tree = NULL; |
| 204 | | | int hf_mode_request; |
| 205 | | | int hf_toc_frame_type_high; |
| 206 | | | int hf_toc_frame_type_low; |
| 207 | | | |
| 208 | | | |
| 209 | | | |
| 210 | | | |
| 211 | | | |
| 212 | | | guint8 speech_data_len[0x20]; |
| 213 | | | |
| 214 | | | |
| 215 | | | if (check_col(pinfo->cinfo, COL_PROTOCOL)) |
| 216 | | | { |
| 217 | | | col_set_str(pinfo->cinfo, COL_PROTOCOL, "EVRC"); |
| 218 | | | } |
| 219 | | | |
| 220 | | | if (!tree) return; |
| 221 | | | |
| 222 | | | offset = 0; |
| 223 | | | orig_offset = offset; |
| 224 | | | |
| 225 | | | g_pinfo = pinfo; |
| 226 | | | g_tree = tree; |
| 227 | | | |
| 228 | | | if (NULL == tree) return; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 229 | | | |
| 230 | | | len = tvb_length(tvb); |
| 231 | | | |
| 232 | | | item = proto_tree_add_item(tree, proto_evrc, tvb, 0, -1, FALSE); |
| 233 | | | |
| 234 | | | evrc_tree = proto_item_add_subtree(item, ett_evrc); |
| 235 | | | |
| 236 | | | proto_tree_add_item(evrc_tree, hf_evrc_reserved, tvb, offset, 1, FALSE); |
| 237 | | | proto_tree_add_item(evrc_tree, hf_evrc_interleave_length, tvb, offset, 1, FALSE); |
| 238 | | | proto_tree_add_item(evrc_tree, hf_evrc_interleave_index, tvb, offset, 1, FALSE); |
| 239 | | | |
| 240 | | | offset++; |
| 241 | | | |
| 242 | | | if (evrc_variant == EVRC_VARIANT_EVRC_LEGACY) |
| 243 | | | { |
| 244 | | | |
| 245 | | | |
| 246 | | | frame_count = 0; |
| 247 | | | further_entries = TRUE; |
| 248 | | | while (further_entries && |
| 249 | | | ((len - (offset - orig_offset)) > 0)) |
| 250 | | | { |
| 251 | | | item = |
| 252 | | | proto_tree_add_text(evrc_tree, tvb, offset, 1, "ToC [%u]", frame_count+1); |
| 253 | | | |
| 254 | | | toc_tree = proto_item_add_subtree(item, ett_toc); |
| 255 | | | |
| 256 | | | proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_fe_ind, tvb, offset, 1, FALSE); |
| 257 | | | proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_reduc_rate, tvb, offset, 1, FALSE); |
| 258 | | | proto_tree_add_item(toc_tree, hf_evrc_legacy_toc_frame_type, tvb, offset, 1, FALSE); |
| 259 | | | |
| 260 | | | oct = tvb_get_guint8(tvb, offset); |
| 261 | | | further_entries = (oct & 0x80) ? TRUE : FALSE; |
| 262 | | | |
| 263 | | | speech_data_len[frame_count] = evrc_frame_type_to_octs((guint8)(oct & 0x7f)); |
| 264 | | | |
| 265 | | | frame_count++; |
| 266 | | | offset++; |
| 267 | | | } |
| 268 | | | } |
| 269 | | | else |
| 270 | | | { |
| 271 | | | |
| 272 | | | |
| 273 | | | switch (evrc_variant) |
| 274 | | | { |
| 275 | | | case EVRC_VARIANT_EVRC: |
| 276 | | | hf_mode_request = hf_evrc_mode_request; |
| 277 | | | hf_toc_frame_type_high = hf_evrc_toc_frame_type_high; |
| 278 | | | hf_toc_frame_type_low = hf_evrc_toc_frame_type_low; |
| 279 | | | break; |
| 280 | | | |
| 281 | | | case EVRC_VARIANT_EVRC_B: |
| 282 | | | hf_mode_request = hf_evrc_b_mode_request; |
| 283 | | | hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high; |
| 284 | | | hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low; |
| 285 | | | break; |
| 286 | | | |
| 287 | | | case EVRC_VARIANT_EVRC_WB: |
| 288 | | | hf_mode_request = hf_evrc_wb_mode_request; |
| 289 | | | hf_toc_frame_type_high = hf_evrc_b_toc_frame_type_high; |
| 290 | | | hf_toc_frame_type_low = hf_evrc_b_toc_frame_type_low; |
| 291 | | | break; |
| 292 | | | |
| 293 | | | default: |
| 294 | | | return; |
| 295 | | | } |
| 296 | | | |
| 297 | | | proto_tree_add_item(evrc_tree, hf_mode_request, tvb, offset, 1, FALSE); |
| 298 | | | proto_tree_add_item(evrc_tree, hf_evrc_frame_count, tvb, offset, 1, FALSE); |
| 299 | | | |
| 300 | | | |
| 301 | | | |
| 302 | | | |
| 303 | | | frame_count = (tvb_get_guint8(tvb, offset) & 0x1f) + 1; |
| 304 | | | |
| 305 | | | offset++; |
| 306 | | | saved_offset = offset; |
| 307 | | | |
| 308 | | | item = |
| 309 | | | proto_tree_add_text(evrc_tree, tvb, offset, -1, "ToC - %u frame%s", |
| 310 | | | frame_count, plurality(frame_count, "", "s")); |
| 311 | | | |
| 312 | | | toc_tree = proto_item_add_subtree(item, ett_toc); |
| 313 | | | |
| 314 | | | i = 0; |
| 315 | | | while ((i < frame_count) && |
| 316 | | | ((len - (offset - orig_offset)) > 0)) |
| 317 | | | { |
| 318 | | | oct = tvb_get_guint8(tvb, offset); |
| 319 | | | |
| 320 | | | proto_tree_add_item(toc_tree, hf_toc_frame_type_high, tvb, offset, 1, FALSE); |
| 321 | | | |
| 322 | | | speech_data_len[i] = evrc_frame_type_to_octs((guint8)((oct & 0xf0) >> 4)); |
| 323 | | | |
| 324 | | | i++; |
| 325 | | | |
| 326 | | | if ((frame_count & 0x01) == 0) |
| 327 | | | { |
| 328 | | | |
| 329 | | | proto_tree_add_item(toc_tree, hf_toc_frame_type_low, tvb, offset, 1, FALSE); |
| 330 | | | |
| 331 | | | speech_data_len[i] = evrc_frame_type_to_octs((guint8)(oct & 0x0f)); |
| 332 | | | |
| 333 | | | i++; |
| 334 | | | } |
| 335 | | | |
| 336 | | | offset++; |
| 337 | | | } |
| 338 | | | |
| 339 | | | if (frame_count & 0x01) |
| 340 | | | { |
| 341 | | | |
| 342 | | | proto_tree_add_item(toc_tree, hf_evrc_padding, tvb, offset-1, 1, FALSE); |
| 343 | | | } |
| 344 | | | |
| 345 | | | proto_item_set_len(item, (offset - 1) - saved_offset); |
| 346 | | | } |
| 347 | | | |
| 348 | | | i = 0; |
| 349 | | | while ((i < frame_count) && |
| 350 | | | ((len - (offset - orig_offset)) >= speech_data_len[i])) |
| 351 | | | { |
| 352 | | | proto_tree_add_text(evrc_tree, tvb, offset, speech_data_len[i], "Speech Data [%u]", i+1); |
| 353 | | | |
| 354 | | | offset += speech_data_len[i]; |
| 355 | | | i++; |
| 356 | | | } |
| 357 | | | } |
| |