(/home/sate/Testcases/c/cve/wireshark-1.2.0/gtk/main_proto_draw.c) |
| |
| 756 | | | copy_hex_cb(GtkWidget * w _U_, gpointer data _U_, copy_data_type data_type) |
| 757 | | | { |
| 758 | | | GtkWidget *bv; |
| 759 | | | |
| 760 | | | guint len = 0; |
| 761 | | | int bytes_consumed = 0; |
| 762 | | | int flags; |
| 763 | | | |
| 764 | | | const guint8* data_p; |
| 765 | | | |
| 766 | | | GString* copy_buffer = g_string_new(""); |
| 767 | | | |
| 768 | | | bv = get_notebook_bv_ptr(byte_nb_ptr); |
| 769 | | | if (bv == NULL) { |
| 770 | | | |
| 771 | | | simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not find the corresponding text window!"); |
| 772 | | | return; |
| 773 | | | } |
| 774 | | | |
| 775 | | | data_p = get_byte_view_data_and_length(bv, &len); |
| 776 | | | g_assert(data_p != NULL);
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 777 | | | |
| 778 | | | flags = data_type & CD_FLAGSMASK; |
| 779 | | | data_type = data_type & CD_TYPEMASK; |
| 780 | | | |
| 781 | | | if(flags & CD_FLAGS_SELECTEDONLY) { |
| 782 | | | int start, end; |
| 783 | | | |
| 784 | | | |
| 785 | | | |
| 786 | | | |
| 787 | | | |
| 788 | | | |
| 789 | | | end = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_START_KEY));
x /usr/include/glib-2.0/gobject/gobject.h |
| |
52 | #define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
181 | #define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
222 | #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) |
| |
|
| 790 | | | start = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(bv), E_BYTE_VIEW_END_KEY));
x /usr/include/glib-2.0/gobject/gobject.h |
| |
52 | #define G_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), G_TYPE_OBJECT, GObject)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
482 | #define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) (_G_TYPE_CIC ((instance), (g_type), c_type)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
1678 | # define _G_TYPE_CIC(ip, gt, ct) \ |
1679 | ((ct*) g_type_check_instance_cast ((GTypeInstance*) ip, gt)) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
181 | #define G_TYPE_OBJECT G_TYPE_MAKE_FUNDAMENTAL (20) |
| |
x /usr/include/glib-2.0/gobject/gtype.h |
| |
222 | #define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT)) |
| |
|
| 791 | | | |
| 792 | | | if(start >= 0 && end > start && (end - start <= (int)len)) { |
| 793 | | | len = end - start; |
| 794 | | | data_p += start; |
| 795 | | | } |
| 796 | | | } |
| 797 | | | |
| 798 | | | switch(data_type) { |
| 799 | | | case(CD_ALLINFO): |
| 800 | | | |
| 801 | | | copy_hex_all_info(copy_buffer, data_p, len, TRUE); |
| 802 | | | break; |
| 803 | | | case(CD_HEXCOLUMNS): |
| 804 | | | |
| 805 | | | copy_hex_all_info(copy_buffer, data_p, len, FALSE); |
| 806 | | | break; |
| 807 | | | case(CD_BINARY): |
| 808 | | | |
| 809 | | | copy_binary_to_clipboard(data_p,len); |
| 810 | | | break; |
| 811 | | | default: |
| 812 | | | |
| 813 | | | while (len > 0){ |
| 814 | | | switch(data_type) { |
| 815 | | | case (CD_TEXTONLY): |
| 816 | | | bytes_consumed = copy_hex_bytes_text_only(copy_buffer, data_p, len); |
| 817 | | | break; |
| 818 | | | case (CD_HEX): |
| 819 | | | bytes_consumed = copy_hex_bytes_hex(copy_buffer, data_p, len); |
| 820 | | | break; |
| 821 | | | default: |
| 822 | | | g_assert_not_reached();
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
73 | #define g_assert_not_reached() do { g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, NULL); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 823 | | | break; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 824 | | | } |
| 825 | | | |
| 826 | | | g_assert(bytes_consumed>0);
x /usr/include/glib-2.0/glib/gtestutils.h |
| |
74 | #define g_assert(expr) do { if G_LIKELY (expr) ; else \ |
75 | g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \ |
76 | #expr); } while (0) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
277 | #define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1)) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
268 | #define _G_BOOLEAN_EXPR(expr) \ |
269 | __extension__ ({ \ |
270 | int _g_boolean_var_; \ |
271 | if (expr) \ |
272 | _g_boolean_var_ = 1; \ |
273 | else \ |
274 | _g_boolean_var_ = 0; \ |
275 | _g_boolean_var_; \ |
276 | }) |
| |
x /usr/include/glib-2.0/glib/gmacros.h |
| |
160 | # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__)) |
| |
|
| 827 | | | data_p += bytes_consumed; |
| 828 | | | len -= bytes_consumed; |
| 829 | | | } |
| 830 | | | break; |
| 831 | | | } |
| 832 | | | |
| 833 | | | if(copy_buffer->len > 0) { |
| 834 | | | copy_to_clipboard(copy_buffer); |
| 835 | | | } |
| 836 | | | |
| 837 | | | g_string_free(copy_buffer, TRUE); |
| 838 | | | } |
| |