summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cpp/cpp.h
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-09-24 05:13:03 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-09-24 05:13:03 +0200
commitbba6d26ca26a60690d50b3fe41a8778abd66cff0 (patch)
treea4422c245464ffbbf529163e776790148062a015 /sys/src/cmd/cpp/cpp.h
parent2b5ab91775b97d9e53b2c92a45164703855029a2 (diff)
downloadplan9front-bba6d26ca26a60690d50b3fe41a8778abd66cff0.tar.xz
cpp: fix memory corruption due to input buffer relocation
the dynamic input buffer resize code (fillbuf()) is broken as the calling code assumes that memory wont relocate. instead of trying to work out all the cases where this happens, i'm getting rid of fillbuf() and just read the whole file into memory in setsource(). the bug could be reproduced with something as simple as: @{for(i in `{seq 1 10000}){echo $i ', \'; }} | cpp
Diffstat (limited to 'sys/src/cmd/cpp/cpp.h')
-rw-r--r--sys/src/cmd/cpp/cpp.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/sys/src/cmd/cpp/cpp.h b/sys/src/cmd/cpp/cpp.h
index 8299614a7..2f70ffcfe 100644
--- a/sys/src/cmd/cpp/cpp.h
+++ b/sys/src/cmd/cpp/cpp.h
@@ -29,7 +29,6 @@ enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE,
#define ISMAC 010 /* builtin macro, e.g. __LINE__ */
#define ISVARMAC 020 /* variadic macro */
-#define EOB 0xFE /* sentinel for end of input buffer */
#define EOFC 0xFD /* sentinel for end of input file */
#define XPWS 1 /* token flag: white space to assure token sep. */
@@ -58,7 +57,6 @@ typedef struct source {
uchar *inb; /* input buffer */
uchar *inp; /* input pointer */
uchar *inl; /* end of input */
- int ins; /* input buffer size */
int fd; /* input source */
int ifdepth; /* conditional nesting in include */
struct source *next; /* stack for #include */
@@ -102,7 +100,6 @@ void *domalloc(int);
void dofree(void *);
void error(enum errtype, char *, ...);
void flushout(void);
-int fillbuf(Source *);
int trigraph(Source *);
int foldline(Source *);
Nlist *lookup(Token *, int);