(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-h264.c) |
| |
| 377 | | | dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint *start_bit_offset, h264_golomb_descriptors descriptor) |
| 378 | | | |
| 379 | | | { |
| 380 | | | gint leading_zero_bits, bit_offset; |
| 381 | | | guint32 codenum, mask, value, tmp; |
| 382 | | | gint32 se_value=0; |
| 383 | | | gint b; |
| 384 | | | char *str; |
| 385 | | | int bit; |
| 386 | | | int i; |
| 387 | | | *hf_field = NULL; |
| 388 | | | |
| 389 | | | if(hf_index > -1) |
| 390 | | | hf_field = proto_registrar_get_nth(hf_index); |
| 391 | | | |
| 392 | | | bit_offset = *start_bit_offset; |
| 393 | | | |
| 394 | | | |
| 395 | | | str=ep_alloc(256); |
| 396 | | | str[0]='\0'; |
| 397 | | | for(bit=0;bit<((int)(bit_offset&0x07));bit++){ |
| 398 | | | if(bit&&(!(bit%4))){ |
| 399 | | | g_strlcat(str, " ", 256); |
| 400 | | | } |
| 401 | | | g_strlcat(str,".", 256); |
| 402 | | | } |
| 403 | | | |
| 404 | | | |
| 405 | | | leading_zero_bits = -1; |
| 406 | | | for( b = 0; !b; leading_zero_bits++ ){ |
| 407 | | | if(bit&&(!(bit%4))){ |
| 408 | | | g_strlcat(str, " ", 256); |
| 409 | | | } |
| 410 | | | if(bit&&(!(bit%8))){ |
| 411 | | | g_strlcat(str, " ", 256); |
| 412 | | | } |
| 413 | | | b = tvb_get_bits8(tvb, bit_offset, 1); |
| 414 | | | if(b != 0){ |
| 415 | | | g_strlcat(str, "1", 256); |
| 416 | | | } else { |
| 417 | | | g_strlcat(str, "0", 256); |
| 418 | | | } |
| 419 | | | bit++; |
| 420 | | | bit_offset++; |
| 421 | | | } |
| 422 | | | |
| 423 | | | if(leading_zero_bits==0){ |
| 424 | | | codenum = 0; |
| 425 | | | *start_bit_offset = bit_offset; |
| 426 | | | for(;bit%8;bit++){ |
| 427 | | | if(bit&&(!(bit%4))){ |
| 428 | | | g_strlcat(str, " ", 256); |
| 429 | | | } |
| 430 | | | g_strlcat(str,".", 256); |
| 431 | | | } |
| 432 | | | if(hf_field){ |
| 433 | | | g_strlcat(str," = ", 256); |
| 434 | | | g_strlcat(str,hf_field->name, 256); |
| 435 | | | switch (descriptor){ |
| 436 | | | case H264_SE_V: |
| 437 | | | |
| 438 | | | |
| 439 | | | |
| 440 | | | |
| 441 | | | |
| 442 | | | if(hf_field->type==FT_INT32){ |
| 443 | | | if (hf_field->strings) { |
| 444 | | | proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 445 | | | "%s: %s (%d)", |
| 446 | | | str, |
| 447 | | | val_to_str(codenum, cVALS(hf_field->strings), "Unknown "), |
| 448 | | | codenum); |
| 449 | | | }else{ |
| 450 | | | switch(hf_field->display){ |
| 451 | | | case BASE_DEC: |
| 452 | | | proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 453 | | | "%s: %d", |
| 454 | | | str, |
| 455 | | | codenum); |
| 456 | | | break; |
| 457 | | | default: |
| 458 | | | 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)) |
| |
|
| 459 | | | break; |
| 460 | | | } |
| 461 | | | } |
| 462 | | | } |
| 463 | | | return codenum; |
| 464 | | | default: |
| 465 | | | break; |
| 466 | | | } |
| 467 | | | if(hf_field->type==FT_UINT32){ |
| 468 | | | if (hf_field->strings) { |
| 469 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 470 | | | "%s: %s (%u)", |
| 471 | | | str, |
| 472 | | | val_to_str(codenum, cVALS(hf_field->strings), "Unknown "), |
| 473 | | | codenum); |
| 474 | | | }else{ |
| 475 | | | switch(hf_field->display){ |
| 476 | | | case BASE_DEC: |
| 477 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 478 | | | "%s: %u", |
| 479 | | | str, |
| 480 | | | codenum); |
| 481 | | | break; |
| 482 | | | case BASE_HEX: |
| 483 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 484 | | | "%s: 0x%x", |
| 485 | | | str, |
| 486 | | | codenum); |
| 487 | | | break; |
| 488 | | | default: |
| 489 | | | 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)) |
| |
|
| 490 | | | break; |
| 491 | | | } |
| 492 | | | } |
| 493 | | | }else{ |
| 494 | | | |
| 495 | | | 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)) |
| |
|
| 496 | | | } |
| 497 | | | } |
| 498 | | | return codenum; |
| 499 | | | } |
| 500 | | | |
| 501 | | | |
| 502 | | | |
| 503 | | | |
| 504 | | | |
| 505 | | | |
| 506 | | | |
| 507 | | | |
| 508 | | | |
| 509 | | | |
| 510 | | | |
| 511 | | | |
| 512 | | | |
| 513 | | | |
| 514 | | | codenum = 1; |
| 515 | | | codenum = codenum << leading_zero_bits; |
| 516 | | | mask = codenum>>1; |
| 517 | | | if (leading_zero_bits > 8) |
| 518 | | | value = tvb_get_bits16(tvb, bit_offset,leading_zero_bits, FALSE); |
| 519 | | | else |
| 520 | | | value = tvb_get_bits8(tvb, bit_offset,leading_zero_bits ); |
| 521 | | | codenum = (codenum-1) + value; |
| 522 | | | bit_offset = bit_offset + leading_zero_bits; |
| 523 | | | |
| 524 | | | |
| 525 | | | for(i=0;i<leading_zero_bits;i++){ |
| 526 | | | if(bit&&(!(bit%4))){ |
| 527 | | | g_strlcat(str, " ", 256); |
| 528 | | | } |
| 529 | | | if(bit&&(!(bit%8))){ |
| 530 | | | g_strlcat(str, " ", 256); |
| 531 | | | } |
| 532 | | | bit++; |
| 533 | | | tmp = value & mask; |
| 534 | | | if(tmp != 0){ |
| 535 | | | g_strlcat(str, "1", 256); |
| 536 | | | } else { |
| 537 | | | g_strlcat(str, "0", 256); |
| 538 | | | } |
| 539 | | | mask = mask>>1; |
| 540 | | | } |
| 541 | | | for(;bit%8;bit++){ |
| 542 | | | if(bit&&(!(bit%4))){ |
| 543 | | | g_strlcat(str, " ", 256); |
| 544 | | | } |
| 545 | | | g_strlcat(str,".", 256); |
| 546 | | | } |
| 547 | | | |
| 548 | | | switch (descriptor){ |
| 549 | | | case H264_SE_V: |
| 550 | | | |
| 551 | | | |
| 552 | | | |
| 553 | | | |
| 554 | | | |
| 555 | | | |
| 556 | | | |
| 557 | | | se_value = (codenum + 1) >> 1; |
| 558 | | | if (!(se_value & 1)){ |
| 559 | | | se_value = - se_value; |
| 560 | | | } |
| 561 | | | break; |
| 562 | | | default: |
| 563 | | | break; |
| 564 | | | } |
| 565 | | | |
| 566 | | | if(hf_field){ |
| 567 | | | g_strlcat(str," = ", 256); |
| 568 | | | g_strlcat(str,hf_field->name, 256); |
| 569 | | | switch (descriptor){ |
| 570 | | | case H264_SE_V: |
| 571 | | | g_strlcat(str,"(se(v))", 256); |
| 572 | | | |
| 573 | | | |
| 574 | | | |
| 575 | | | |
| 576 | | | |
| 577 | | | break; |
| 578 | | | default: |
| 579 | | | break; |
| 580 | | | } |
| 581 | | | if((hf_field->type==FT_UINT32)&&(descriptor==H264_UE_V)){ |
| 582 | | | if (hf_field->strings) { |
| 583 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 584 | | | "%s: %s (%u)", |
| 585 | | | str, |
| 586 | | | val_to_str(codenum, cVALS(hf_field->strings), "Unknown "), |
| 587 | | | codenum); |
| 588 | | | }else{ |
| 589 | | | switch(hf_field->display){ |
| 590 | | | case BASE_DEC: |
| 591 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 592 | | | "%s: %u", |
| 593 | | | str, |
| 594 | | | codenum); |
| 595 | | | break; |
| 596 | | | case BASE_HEX: |
| 597 | | | proto_tree_add_uint_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 598 | | | "%s: 0x%x", |
| 599 | | | str, |
| 600 | | | codenum); |
| 601 | | | break; |
| 602 | | | default: |
| 603 | | | 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)) |
| |
|
| 604 | | | break; |
| 605 | | | } |
| 606 | | | } |
| 607 | | | }else if((hf_field->type==FT_INT32)&&(descriptor==H264_SE_V)){ |
| 608 | | | if (hf_field->strings) { |
| 609 | | | proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 610 | | | "%s: %s (%d)", |
| 611 | | | str, |
| 612 | | | val_to_str(codenum, cVALS(hf_field->strings), "Unknown "), |
| 613 | | | se_value); |
| 614 | | | }else{ |
| 615 | | | switch(hf_field->display){ |
| 616 | | | case BASE_DEC: |
| 617 | | | proto_tree_add_int_format(tree, hf_index, tvb, bit_offset>>3, 1, codenum, |
| 618 | | | "%s: %d", |
| 619 | | | str, |
| 620 | | | se_value); |
| 621 | | | break; |
| 622 | | | default: |
| 623 | | | 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)) |
| |
|
| 624 | | | break; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 625 | | | } |
| 626 | | | } |
| 627 | | | *start_bit_offset = bit_offset; |
| 628 | | | return se_value; |
| 629 | | | |
| 630 | | | }else{ |
| 631 | | | |
| 632 | | | 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)) |
| |
|
| 633 | | | } |
| 634 | | | } |
| 635 | | | |
| 636 | | | *start_bit_offset = bit_offset; |
| 637 | | | return codenum; |
| 638 | | | |
| 639 | | | } |
| |