From 867cc23e444dd4fd25717f8df280b03718b99907 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Tue, 8 Aug 2006 09:33:10 +0000 Subject: * etags.c (TEX_mode): Check getc retruns EOF. File ended without newline causes infinite loop. --- lib-src/ChangeLog | 5 +++++ lib-src/etags.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index f61188fb8d5..84b15459322 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-07 Masatake YAMATO + + * etags.c (TEX_mode): Check getc retruns EOF. + File ended without newline causes infinite loop. + 2002-07-30 Adrian Aichner (tiny change) * etags.c: It's XEmacs, not Xemacs: change all the occurences. diff --git a/lib-src/etags.c b/lib-src/etags.c index d60c12c2bcc..d455ddc276d 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -5165,7 +5165,7 @@ TEX_mode (inf) { /* Skip to next line if we hit the TeX comment char. */ if (c == '%') - while (c != '\n') + while (c != '\n' && c != EOF) c = getc (inf); else if (c == TEX_LESC || c == TEX_SESC ) break; -- cgit v1.2.1 From 1520a816ef390058c2afb984326cd6615e0487df Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Tue, 8 Aug 2006 09:34:56 +0000 Subject: * etags.c (readline): expect sscanf returns 2, not 1. --- lib-src/ChangeLog | 5 +++++ lib-src/etags.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 84b15459322..ae6ddedf5f7 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2006-08-07 Masatake YAMATO + + * etags.c (readline): expect sscanf returns 2, + not 1. + 2006-08-07 Masatake YAMATO * etags.c (TEX_mode): Check getc retruns EOF. diff --git a/lib-src/etags.c b/lib-src/etags.c index d455ddc276d..50f7162ded0 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,7 +6259,7 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 1) + if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 2) { char *endp = lbp->buffer + start; -- cgit v1.2.1 From 1f4edc37b89c6981092342ed44328bbdf7efd73a Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Wed, 9 Aug 2006 06:22:27 +0000 Subject: * etags.c (readline): expect sscanf returns >= 1. --- lib-src/ChangeLog | 4 ++++ lib-src/etags.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index ae6ddedf5f7..3e7d9efad31 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2006-08-09 Jan Dj,Ad(Brv + + * etags.c (readline): expect sscanf returns >= 1. + 2006-08-07 Masatake YAMATO * etags.c (readline): expect sscanf returns 2, diff --git a/lib-src/etags.c b/lib-src/etags.c index 50f7162ded0..c7d18d34849 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,7 +6259,7 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) == 2) + if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) >= 1) { char *endp = lbp->buffer + start; -- cgit v1.2.1 From ea90c5d3bdb03846cbe7845b65d5be1343eddbe3 Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Wed, 9 Aug 2006 06:56:16 +0000 Subject: (readline): Change position on %n and \" in sscanf. --- lib-src/ChangeLog | 1 + lib-src/etags.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 3e7d9efad31..3328f010846 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,6 +1,7 @@ 2006-08-09 Jan Dj,Ad(Brv * etags.c (readline): expect sscanf returns >= 1. + (readline): Change position on %n and \" in sscanf. 2006-08-07 Masatake YAMATO diff --git a/lib-src/etags.c b/lib-src/etags.c index c7d18d34849..b02268ac218 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6259,9 +6259,10 @@ readline (lbp, stream) int start, lno; if (DEBUG) start = 0; /* shut up the compiler */ - if (sscanf (lbp->buffer, "#line %d \"%n", &lno, &start) >= 1) + if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 + && inp[start] == '"') { - char *endp = lbp->buffer + start; + char *endp = lbp->buffer + ++start; assert (start > 0); while ((endp = etags_strchr (endp, '"')) != NULL -- cgit v1.2.1 From ae587d1d0cc496d38a369db44dfa0d2d1598d1ae Mon Sep 17 00:00:00 2001 From: Jan Djärv Date: Wed, 9 Aug 2006 06:56:38 +0000 Subject: Fix previous change. --- lib-src/etags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib-src') diff --git a/lib-src/etags.c b/lib-src/etags.c index b02268ac218..49a18be1df5 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -6260,7 +6260,7 @@ readline (lbp, stream) if (DEBUG) start = 0; /* shut up the compiler */ if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 - && inp[start] == '"') + && lbp->buffer[start] == '"') { char *endp = lbp->buffer + ++start; -- cgit v1.2.1