Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Control Flow  at packet-ismacryp.c:340

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

dissect_ismacryp_common

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ismacryp.c)expand/collapse
Show more  
 258  static void dissect_ismacryp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint ismacryp_version)
 259  {
 260          guint set_version;           /* ISMACryp version used during dissection */
 261          proto_item *ismacryp_item;
 262          proto_tree *ismacryp_tree;
 263          proto_tree *ismacryp_message_tree;
 264           
 265          /* select and display ISMACryp version */
 266          if ((ismacryp_version!=version_type) && override_flag){  
 267                  /* override -> use manual preference setting */
 268                  if (check_col(pinfo->cinfo, COL_INFO)){
 269                          col_append_str(pinfo->cinfo, COL_INFO, " Manual version");
 270                  }
 271                  set_version = version_type; /* set to preference value */
 272          }
 273          else {
 274                  set_version = ismacryp_version;
 275          }
 276   
 277          if (set_version == V11){
 278                  if (check_col(pinfo->cinfo, COL_PROTOCOL))
 279                          col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_11);
 280                  /* display mode */
 281                  if (pref_user_mode == FALSE){    
 282                          if (check_col( pinfo->cinfo, COL_INFO))  
 283                                  col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",val_to_str(mode, modetypenames, "user mode"));
 284                  }
 285                  if (pref_user_mode == TRUE){    
 286                          if ( check_col( pinfo->cinfo, COL_INFO))
 287                                  col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode");
 288                  }
 289                  user_mode = pref_user_mode;
 290          }
 291          if (set_version == V20){
 292                  if (check_col(pinfo->cinfo, COL_PROTOCOL))
 293                          col_set_str(pinfo->cinfo, COL_PROTOCOL, PROTO_TAG_ISMACRYP_20);
 294                  user_mode = TRUE;
 295                  /* display mode */
 296                  if (check_col( pinfo->cinfo, COL_INFO))  
 297                          col_append_fstr(pinfo->cinfo, COL_INFO, ", %s","user mode");
 298          }
 299          /* select correct AU values depending on version & selected mode in preferences menu if not in user_mode */
 300          if (user_mode == TRUE){ /* use values set in preference menu */
 301                  au_size_length = pref_au_size_length;
 302                  au_index_length = pref_au_index_length;
 303                  au_index_delta_length = pref_au_index_delta_length;
 304                  cts_delta_length = pref_cts_delta_length;
 305                  dts_delta_length = pref_dts_delta_length;
 306                  random_access_indication = pref_random_access_indication;
 307                  stream_state_indication = pref_stream_state_indication;                          
 308          } /* end if user_mode == TRUE */
 309          if (user_mode == FALSE){
 310                  switch (mode){
 311                          case AAC_HBR_MODE:
 312                                  au_size_length = 13;
 313                                  au_index_length = 3;
 314                                  au_index_delta_length = 3;
 315                                  cts_delta_length = 0;
 316                                  dts_delta_length = 0;
 317                                  random_access_indication = FALSE;
 318                                  stream_state_indication = 0;
 319                                  break;
 320                          case MPEG4_VIDEO_MODE:
 321                                  au_size_length = 0;
 322                                  au_index_length = 0;
 323                                  au_index_delta_length = 0;
 324                                  cts_delta_length = 0;
 325                                  dts_delta_length = 22;
 326                                  random_access_indication = TRUE;
 327                                  stream_state_indication = 0;
 328                                  break;
 329                          case AVC_VIDEO_MODE:
 330                                  au_size_length = 0;
 331                                  au_index_length = 0;
 332                                  au_index_delta_length = 0;
 333                                  cts_delta_length = 0;
 334                                  dts_delta_length = 22;
 335                                  random_access_indication = TRUE;
 336                                  stream_state_indication = 0;
 337                                  break;
 338                          default:
 339                                  DISSECTOR_ASSERT_NOT_REACHED();
 340                                  break;
 341                  } /* end switch */
 342          } /* end if user_mode == FALSE */
 343           
 344          /* navigate through buffer */
 345          if (tree)
 346          {
 347                  /* we are being asked for details */
 348                   
 349                  guint16 au_headers_length = 0; /* total length of AU headers */
 350                  guint16 totalbits =0;          /* keeps track of total number of AU header bits treated (used to determine end of AU headers) */
 351                  int deltabits = -1;            /* keeps track of extra bits per AU header treated (used to determine end of AU heafers ) */
 352                  guint16 totalbit_offset = 0;   /* total offset in bits*/
 353                  int nbpadding_bits = 0;        /* number of padding bits*/
 354                  offset_struct s_offset;
 355                  offset_struct* poffset;
 356                  guint16 nbmessage_bytes = 0;   /*nb of message data bytes */
 357                  s_offset.offset_bytes = 0;     /* initialise byte offset */
 358                  s_offset.offset_bits = 0;      /* initialise bit offset */
 359                  poffset = &s_offset;
 360                   
 361                  ismacryp_item = proto_tree_add_item(tree, proto_ismacryp, tvb, 0, -1, FALSE);
 362                  ismacryp_tree = proto_item_add_subtree(ismacryp_item, ett_ismacryp);
 363                  proto_item_append_text(tree, ", %s", "ismacryp packet"); /* add text to tree */          
 364                   
 365                  /* ismacryp_tree analysis */
 366                  /* we are being asked for details */  
 367                  /* get total length of AU headers (first 2 bytes) */
 368                  ismacryp_item = proto_tree_add_item(ismacryp_tree, hf_ismacryp_au_headers_length,  
 369                                                      tvb, poffset->offset_bytes, AU_HEADERS_LENGTH_SIZE, FALSE );
 370                  proto_item_append_text(ismacryp_item, " (bits)"); /* add text to AU Header tree indicating length */
 371                  au_headers_length=tvb_get_ntohs(tvb,poffset->offset_bytes); /* 2 byte au headers length */
 372                  poffset->offset_bytes+=AU_HEADERS_LENGTH_SIZE;
 373                  /* ADD HEADER(S) BRANCH  */
 374           
 375                  /* AU Header loop */
 376                  totalbits=(poffset->offset_bytes*8)+poffset->offset_bits;
 377                  while( ((totalbits-8*AU_HEADERS_LENGTH_SIZE)<au_headers_length) && deltabits!=0 ) /* subtract AU headers length bits*/
 378                  {
 379                          poffset=dissect_auheader( tvb, poffset, pinfo, ismacryp_tree, set_version);
 380                          deltabits=(poffset->offset_bytes*8)+poffset->offset_bits - totalbits; /* if zero this means no actual AU header so exit while loop */
 381                          totalbits+=deltabits;    
 382                  }
 383                  /* reached end of AU Header(s) */
 384                  /* sanity check if actual total AU headers length in bits i.e. totalbits is */
 385                  /*  the same as expected AU headers length from 2 bytes at start of buffer */
 386                  if ( (totalbits-8*AU_HEADERS_LENGTH_SIZE) != au_headers_length) /* something wrong */
 387                  {
 388                          proto_item_append_text(ismacryp_item,  
 389                                                 " Error - expected total AU headers size (%d bits) "
 390                                                 "does not match calculated size (%d bits) - check parameters!",
 391                                                 au_headers_length,(totalbits-8*AU_HEADERS_LENGTH_SIZE));
 392                  }
 393                  /* add padding if need to byte align */
 394                  if (poffset->offset_bits!=0)
 395                  {
 396                          totalbit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */
 397                          nbpadding_bits = (8-poffset->offset_bits); /* number of padding bits for byte alignment */  
 398                          ismacryp_item = proto_tree_add_bits_item(ismacryp_tree, hf_ismacryp_padding,
 399                                                                   tvb, totalbit_offset, nbpadding_bits , FALSE); /* padding bits */
 400                          proto_item_append_text(ismacryp_item, ": Length=%d bits",nbpadding_bits); /* add padding info */
 401                          add_bits(poffset, nbpadding_bits);
 402                  }
 403                  /* ADD MESSAGE BRANCH  */
 404                  ismacryp_item = proto_tree_add_item( ismacryp_tree, hf_ismacryp_message,  
 405                                                       tvb, poffset->offset_bytes, -1, FALSE );
 406                  ismacryp_message_tree = proto_item_add_subtree(ismacryp_item, ett_ismacryp_message);
 407                  proto_item_append_text(ismacryp_item, ", %s", "Encrypted data"); /* add text to Message tree */
 408                  nbmessage_bytes = tvb_reported_length_remaining(tvb, poffset->offset_bytes);
 409                  proto_item_append_text(ismacryp_item, ", Length= %d bytes", nbmessage_bytes ); /* add length of message */
 410           
 411                  /* ismacryp message tree analysis (encrypted AUs) */
 412                  if (ismacryp_message_tree)
 413                  {       /* we are being asked for details */
 414                          poffset->offset_bytes+= nbmessage_bytes;        /* */
 415                  }  /* end message details */
 416                  /* end ismacryp tree details */          
 417          } /* end if tree */
 418  }        
Show more  




Change Warning 2702.32900 : Unreachable Control Flow

Priority:
State:
Finding:
Owner:
Note: