(/home/sate/Testcases/c/cve/wireshark-1.2.0/wiretap/ngsniffer.c) |
| |
| 2570 | | | ng_file_seek_seq(wtap *wth, gint64 offset, int whence, int *err) |
| 2571 | | | { |
| 2572 | | | gint64 delta; |
| 2573 | | | char buf[65536]; |
| 2574 | | | long amount_to_read; |
| 2575 | | | |
| 2576 | | | if (wth->file_type == WTAP_FILE_NGSNIFFER_UNCOMPRESSED) |
| 2577 | | | return file_seek(wth->fh, offset, whence, err); |
| 2578 | | | |
| 2579 | | | switch (whence) { |
| 2580 | | | |
| 2581 | | | case SEEK_SET:
x /usr/include/stdio.h |
| |
141 | #define SEEK_SET 0 /* Seek from beginning of file. */ |
| |
|
| 2582 | | | break; |
| 2583 | | | |
| 2584 | | | case SEEK_CUR:
x /usr/include/stdio.h |
| |
142 | #define SEEK_CUR 1 /* Seek from current position. */ |
| |
|
| 2585 | | | offset += wth->capture.ngsniffer->seq.uncomp_offset; |
| 2586 | | | break; |
| 2587 | | | |
| 2588 | | | case SEEK_END:
x /usr/include/stdio.h |
| |
143 | #define SEEK_END 2 /* Seek from end of file. */ |
| |
|
| 2589 | | | 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__)) |
| |
|
| 2590 | | | break; |
Unreachable Control Flow
The highlighted code will not execute under any circumstances. This may be because of: |
|
| 2591 | | | } |
| 2592 | | | |
| 2593 | | | delta = offset - wth->capture.ngsniffer->seq.uncomp_offset; |
| 2594 | | | g_assert(delta >= 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__)) |
| |
|
| 2595 | | | |
| 2596 | | | |
| 2597 | | | while (delta != 0) { |
| 2598 | | | amount_to_read = (long) delta; |
| 2599 | | | if ((unsigned long)amount_to_read > sizeof buf) |
| 2600 | | | amount_to_read = sizeof buf; |
| 2601 | | | if (ng_file_read(buf, 1, amount_to_read, wth, FALSE, err) < 0) |
| 2602 | | | return -1; |
| 2603 | | | delta -= amount_to_read; |
| 2604 | | | } |
| 2605 | | | return offset; |
| 2606 | | | } |
| |