forked from Mirrors/tinycc
fix a potential end-of-buffer issue in tccelf.c
also read characters one at a time when PARSE_DEBUG is set; after this patch, things seem to work with that.master
parent
2e04fa8872
commit
951a43ea6c
7
tccelf.c
7
tccelf.c
|
@ -3275,6 +3275,11 @@ static int ld_next(TCCState *s1, char *name, int name_size)
|
||||||
goto parse_name;
|
goto parse_name;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case '\\':
|
||||||
|
ch = handle_eob();
|
||||||
|
if (ch != '\\')
|
||||||
|
goto redo;
|
||||||
|
/* fall through */
|
||||||
/* case 'a' ... 'z': */
|
/* case 'a' ... 'z': */
|
||||||
case 'a':
|
case 'a':
|
||||||
case 'b':
|
case 'b':
|
||||||
|
@ -3330,7 +3335,6 @@ static int ld_next(TCCState *s1, char *name, int name_size)
|
||||||
case 'Y':
|
case 'Y':
|
||||||
case 'Z':
|
case 'Z':
|
||||||
case '_':
|
case '_':
|
||||||
case '\\':
|
|
||||||
case '.':
|
case '.':
|
||||||
case '$':
|
case '$':
|
||||||
case '~':
|
case '~':
|
||||||
|
@ -3462,7 +3466,6 @@ ST_FUNC int tcc_load_ldscript(TCCState *s1)
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
int t, ret;
|
int t, ret;
|
||||||
|
|
||||||
ch = file->buf_ptr[0];
|
|
||||||
ch = handle_eob();
|
ch = handle_eob();
|
||||||
for(;;) {
|
for(;;) {
|
||||||
t = ld_next(s1, cmd, sizeof(cmd));
|
t = ld_next(s1, cmd, sizeof(cmd));
|
||||||
|
|
2
tccpp.c
2
tccpp.c
|
@ -386,7 +386,7 @@ static int tcc_peekc_slow(BufferedFile *bf)
|
||||||
if (bf->buf_ptr >= bf->buf_end) {
|
if (bf->buf_ptr >= bf->buf_end) {
|
||||||
if (bf->fd != -1) {
|
if (bf->fd != -1) {
|
||||||
#if defined(PARSE_DEBUG)
|
#if defined(PARSE_DEBUG)
|
||||||
len = 8;
|
len = 1;
|
||||||
#else
|
#else
|
||||||
len = IO_BUF_SIZE;
|
len = IO_BUF_SIZE;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue