1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>

* view.c (regexp_search): Use unsigned longs for all of the
	offsets here.  Fixes crash reported on bugtraq.
This commit is contained in:
Miguel de Icaza 1999-04-16 23:28:50 +00:00
parent e3ec9338be
commit fc47533c5e
3 changed files with 19 additions and 23 deletions

View File

@ -1,3 +1,8 @@
1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* view.c (regexp_search): Use unsigned longs for all of the
offsets here. Fixes crash reported on bugtraq.
1999-04-16 Federico Mena Quintero <federico@nuclecu.unam.mx>
* treestore.c (tree_store_save_to): Moved the functionality from

View File

@ -214,7 +214,7 @@ view_destroy (WView *view)
}
static int
get_byte (WView *view, int byte_index)
get_byte (WView *view, unsigned int byte_index)
{
int page = byte_index / VIEW_PAGE_SIZE + 1;
int offset = byte_index % VIEW_PAGE_SIZE;
@ -800,7 +800,7 @@ display (WView *view)
int col = 0 + frame_shift;
int row = STATUS_LINES + frame_shift;
int height, width;
long from;
unsigned long from;
int c;
int boldflag = 0;
struct hexedit_change_node *curr = view->change_list;
@ -1096,7 +1096,7 @@ my_define (Dlg_head *h, int idx, char *text,
static long
move_forward2 (WView *view, long current, int lines, long upto)
{
long p, q;
unsigned long q, p;
int line;
int col = 0;
@ -1179,7 +1179,7 @@ move_forward2 (WView *view, long current, int lines, long upto)
of lines up to there and then use move_forward2(p, something, 0), which we
return */
static long
move_backward2 (WView *view, long current, int lines)
move_backward2 (WView *view, unsigned long current, int lines)
{
long p, q, pm;
int line;
@ -1393,13 +1393,13 @@ grow_string_buffer (char *text, int *size)
}
static char *
get_line_at (WView *view, long *p)
get_line_at (WView *view, unsigned long *p)
{
char *buffer = 0;
int buffer_size, usable_size;
int ch;
int direction;
long pos = *p;
unsigned long pos = *p;
long i;
direction = view->direction;
@ -1615,7 +1615,7 @@ block_search (WView *view, char *buffer, int len)
{
int w = view->widget.cols - (view->have_frame * 2);
char *d = buffer, b;
long e;
unsigned long e;
/* clear interrupt status */
got_interrupt ();
@ -1880,8 +1880,9 @@ void
goto_line (WView *view)
{
char *line, prompt [BUF_SMALL];
int i, oldline = 1;
int oldline = 1;
int saved_wrap_mode = view->wrap_mode;
unsigned long i;
view->wrap_mode = 0;
for (i = view->first; i < view->start_display; i++)

View File

@ -28,18 +28,18 @@ typedef struct {
int file; /* File descriptor (for mmap and munmap) */
FILE *stdfile; /* Stdio struct for reading file in parts */
int reading_pipe; /* Flag: Reading from pipe(use popen/pclose) */
long bytes_read; /* How much of file is read */
unsigned long bytes_read; /* How much of file is read */
int mmapping; /* Did we use mmap on the file? */
/* Display information */
long last; /* Last byte shown */
long last_byte; /* Last byte of file */
unsigned long last; /* Last byte shown */
unsigned long last_byte; /* Last byte of file */
long first; /* First byte in file */
long bottom_first; /* First byte shown when very last page is displayed */
/* For the case of WINCH we should reset it to -1 */
long start_display; /* First char displayed */
unsigned long start_display;/* First char displayed */
int start_col; /* First displayed column, negative */
int edit_cursor; /* HexEdit cursor position in file */
unsigned int edit_cursor; /* HexEdit cursor position in file */
char hexedit_mode; /* Hexidecimal editing mode flag */
char nib_shift; /* A flag for inserting nibbles into bytes */
enum ViewSide view_side; /* A flag for the active editing panel */
@ -78,16 +78,6 @@ typedef struct {
int marker; /* mark to use */
int marks [10]; /* 10 marks: 0..9 */
#ifdef HAVE_TK
/* Tk version, line cache */
int current_line; /* The current screen line cached */
char *cache; /* Current cache */
char *color_cache; /* Attributes: keep in sync with cache */
int dest; /* Index in the cache to write to */
int cache_len; /* Length of the cache buffer -1 */
int last_col; /* last column used */
int status_shown; /* Have we show the file information? */
#endif
#ifdef HAVE_GNOME
int current_x, current_y; /* Current x,y position */