-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes: * Fix issue #43: 'out_buf' overflow on malign user input - Handle border case from bug report - Discard rest of input lines exceeding 'buf_size' characters - Purge 'ungetc' from the TeX part as well * Fix typo in 'examples/wordtest.w' (reported by DEK) * 'Ilk' is of type 'eight_bits' * Avoid over-/underflow of section depth with malicious user input Internal changes: * Unroll 'init_p' helper function in COMMON - it is used for CWEAVE only (and CTWILL downstream) * Match 'common.w' and 'common.h' - Reshuffle declarations and some code sections - Add starred section titles * Demote all starred sections in 'common.w' (single star) * Code cleanup - Make 'pop_level' a simple macro in CWEAVE - Use structure assignment (as in CTANGLE) - More compact 'stack' handling - Make use of type 'mode' - Purge a few 'goto' statements (and add some others) - Replace some 'sprintf' with 'snprintf' - Syntactic sugar for functional macros - Straighten 'byte_start' arithmetic - Desolve former section 19 of CWEAVE with internal array sizes - Hide 'print_text' analytics function from C compiler with DEBUG - Streamline 'phase_two' of CTANGLE - Refurbish 'phase_three' of CWEAVE * Insert blank line after '\ch' in TeX output (cf. CWEB 3.0) Macro changes * Cleanup some '\acro' macros in 'cwebmac.tex'
- Loading branch information
Showing
30 changed files
with
799 additions
and
797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,14 @@ No changes to CTANGLE or CWEAVE are needed. | |
(Contributed 13 Oct 2000 by [email protected]; slightly edited by Don Knuth) | ||
@x in limbo, change the title page document to specify Mac version | ||
\centerline{(Version 4.9)} | ||
\centerline{(Version 4.10)} | ||
@y | ||
\centerline{(Version 4.9 for MacOS)} | ||
\centerline{(Version 4.10 for MacOS)} | ||
@z | ||
@x section 23: Make input_ln accept \n, \r, \n\r, or \r\n as line endings | ||
@ In the unlikely event that your standard I/O library does not | ||
support |feof|, |getc|, and |ungetc| you may have to change things here. | ||
support |feof| and |getc| you may have to change things here. | ||
@^system dependencies@> | ||
@c | ||
|
@@ -24,9 +24,9 @@ FILE *fp) /* what file to read from */ | |
limit = k = buffer; /* beginning of buffer */ | ||
while (k<=buffer_end && (c=getc(fp)) != EOF && c!='\n') | ||
if ((*(k++) = c) != ' ') limit = k; | ||
if (k>buffer_end) | ||
if ((c=getc(fp))!=EOF && c!='\n') { | ||
ungetc(c,fp); loc=buffer; err_print("! Input line too long"); | ||
if (k>buffer_end) { | ||
while ((c=getc(fp))!=EOF && c!='\n'); /* discard rest of line */ | ||
loc=buffer; err_print("! Input line too long"); | ||
@.Input line too long@> | ||
} | ||
if (c==EOF && limit==buffer) return false; /* there was nothing after | ||
|
@@ -61,7 +61,7 @@ FILE *fp) /* what file to read from */ | |
return true; | ||
} | ||
else if (k>buffer_end) { | ||
ungetc(c,fp); loc=buffer; err_print("! Input line too long"); | ||
while ((c=getc(fp))!=EOF && c!='\n' && c!='\r'); /* discard rest of line */ | ||
return true; | ||
@.Input line too long@> | ||
} | ||
|
@@ -81,17 +81,7 @@ FILE *fp) /* what file to read from */ | |
@<Skip over comment lines in the change file; |return| if end of file@>@; | ||
@z | ||
|
||
@x section 36, don't try to open a change file if none was specified | ||
if ((change_file=fopen(change_file_name,"r"))==NULL) | ||
fatal("! Cannot open change file ", change_file_name); | ||
@y | ||
if (change_file_name[0] == '\0') /* no change file specified */ | ||
change_file = NULL; /* reset at least the |change_file| */ | ||
else if ((change_file=fopen(change_file_name,"r"))==NULL) | ||
fatal("! Cannot open change file ", change_file_name); | ||
@z | ||
@x section 39, declare colon as Mac's path separator | ||
@x section 36, declare colon as Mac's path separator | ||
(Colon-separated paths are not supported.) | ||
The remainder of the \.{@@i} line after the file name is ignored. | ||
|
@@ -104,12 +94,22 @@ The remainder of the \.{@@i} line after the file name is ignored. | |
@d PATH_SEP ':' /* MacOS pathname separator */ | ||
@^system dependencies@> | ||
@z | ||
@x section 39, use the path separator constant | ||
@x section 36, use the path separator constant | ||
cur_file_name[l]='/'; /* \UNIX/ pathname separator */ | ||
@y | ||
cur_file_name[l]=PATH_SEP; /* pathname separator */ | ||
@z | ||
@x section 41, don't try to open a change file if none was specified | ||
if ((change_file=fopen(change_file_name,"r"))==NULL) | ||
fatal("! Cannot open change file ", change_file_name); | ||
@y | ||
if (change_file_name[0] == '\0') /* no change file specified */ | ||
change_file = NULL; /* reset at least the |change_file| */ | ||
else if ((change_file=fopen(change_file_name,"r"))==NULL) | ||
fatal("! Cannot open change file ", change_file_name); | ||
@z | ||
|
||
@x section 75, explain the convention for omitted change files | ||
An omitted change file argument means that |"/dev/null"| should be used, | ||
@y | ||
|
@@ -134,7 +134,7 @@ An omitted change file argument means that no change file should be used, | |
@z | ||
|
||
@x section 85, insert an extra module before the index | ||
@** Index. | ||
@* Index. | ||
@y by putting the new module here, we preserve all the previous section numbers | ||
@ We assume an interface to \CEE/ command-line emulation as supplied by | ||
the |ccommand| function of Metrowerks CodeWarrior, as defined in | ||
|
@@ -144,5 +144,5 @@ the header file \.{console.h}. | |
#include <console.h> | ||
@^system dependencies@> | ||
|
||
@** Index. | ||
@* Index. | ||
@z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.