coff: Issue fatal signal on relocations more then 0xffff
authorCyrill Gorcunov <gorcunov@gmail.com>
Fri, 5 Nov 2010 23:45:45 +0000 (02:45 +0300)
committerCyrill Gorcunov <gorcunov@gmail.com>
Fri, 5 Nov 2010 23:45:45 +0000 (02:45 +0300)
Actually it's temporary action. We have to support more
relocations then that but it requires some more code rework.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
output/outcoff.c

index 5b232bb..a089b20 100644 (file)
@@ -939,6 +939,10 @@ static void coff_section_header(char *name, int32_t vsize,
     fwriteint32_t(datapos,      ofile);
     fwriteint32_t(relpos,       ofile);
     fwriteint32_t(0L,           ofile); /* no line numbers - we don't do 'em */
+
+    if (nrelocs >= IMAGE_SCN_MAX_RELOC)
+        nasm_error(ERR_FATAL, "Too many relocations (%d)\n", nrelocs);
+
     fwriteint16_t(nrelocs,      ofile);
     fwriteint16_t(0,            ofile); /* again, no line numbers */
     fwriteint32_t(flags,        ofile);