Commit Graph

13 Commits

Author SHA1 Message Date
Anthony J. Bentley
3e4350afa4 Don't cast calls to malloc(). 2014-09-26 00:39:29 -06:00
Anthony J. Bentley
d661b3a532 Now that we replace missing libc functions, switch back to err(). 2014-09-24 02:50:39 -06:00
YamaArashi
2bf31870a7 Cleaned up lexer
- separated the lexer into multiple functions so it is more readable
- fixed issue with long label names in macro arguments
- added error checking code to prevent buffer overflows
2014-08-22 21:44:18 -07:00
Vegard Nossum
2dfd937d7f Prevent lexer from reading beyond the end of the buffer
On Linux, valgrind complains about the overflow like this:

  Pass 1...
  ==20054== Invalid read of size 1
  ==20054==    at 0x406CDA: yylex (lexer.c:396)
  ==20054==    by 0x40207C: yyparse (asmy.c:2921)
  ==20054==    by 0x4086AF: main (main.c:351)
  ==20054==  Address 0x503a102 is 0 bytes after a block of size 23,538 alloc'd
  ==20054==    at 0x402994D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==20054==    by 0x406411: yy_create_buffer (lexer.c:147)
  ==20054==    by 0x404FE3: fstk_RunInclude (fstack.c:243)
  ==20054==    by 0x4025F5: yyparse (asmy.y:744)
  ==20054==    by 0x4086AF: main (main.c:351)
  ==20054==

This is a bit of a crude fix which simply exits the hashing loop when
we reach the end of the string. We should probably do some kind of
length calculation on the buffer instead.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2012-10-21 06:06:54 +02:00
bentley
24c1613f06 remove mswin-type define -- this is UNIX 2010-01-15 16:35:10 -07:00
anthony
a014537837 reran indent (whitespace changes)
Merging lai's source with this one is very irritating because
they have different indentation styles. I couldn't find what profile
vegard used for his version, so I used these flags (which should bring
the source close to KNF):
-bap
-br
-ce
-ci4
-cli0
-d0
-di0
-i8
-ip
-l79
-nbc
-ncdb
-ndj
-ei
-nfc1
-nlp
-npcs
-psl
-sc
-sob
2009-12-30 12:51:32 -07:00
Vegard Nossum
a216855093 Move src/asmotor.h to top-level include/
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 09:29:07 +02:00
Vegard Nossum
cd779b9511 asm: moved includes to include/asm/
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 09:14:19 +02:00
Vegard Nossum
3c82b1ae03 Fixed warnings and some style issues
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 08:51:55 +02:00
Vegard Nossum
b6c749ffbd Run `indent' on the whole tree
Can't indent the .y files yet, they need special treatment.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 07:59:46 +02:00
Vegard Nossum
94fad97aed Switch line terminators from CRLF to LF
Argh, that obnoxious platform again... ;-)

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 07:32:12 +02:00
Vegard Nossum
0d9739535e Use spaces instead of tabs after CPP directives
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 07:26:46 +02:00
Vegard Nossum
b53e170781 Make all file names lowercase
This fixes a zip/platform artifact.

Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
2009-06-11 06:25:27 +02:00