]> granicus.if.org Git - yasm/commitdiff
Avoid crash in section_switch for a number of object formats.
authorPeter Johnson <peter@tortall.net>
Sat, 3 Dec 2005 18:04:59 +0000 (18:04 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 3 Dec 2005 18:04:59 +0000 (18:04 -0000)
Noticed by: Catalin Ionescu <catalin.ionescu@radioconsult.ro>

svn path=/trunk/yasm/; revision=1323

modules/objfmts/bin/bin-objfmt.c
modules/objfmts/coff/coff-objfmt.c
modules/objfmts/elf/elf-objfmt.c
modules/objfmts/xdf/xdf-objfmt.c

index fe5cdc7861443263129de860b51ba731a6ed365b..d2781c54b7ae217a47ab78fe4ade17284d14b05e 100644 (file)
@@ -372,6 +372,12 @@ bin_objfmt_section_switch(yasm_objfmt *objfmt, yasm_valparamhead *valparams,
 
        /* Check for ALIGN qualifier */
        while ((vp = yasm_vps_next(vp))) {
+           if (!vp->val) {
+               yasm__warning(YASM_WARN_GENERAL, line,
+                             N_("Unrecognized numeric qualifier"));
+               continue;
+           }
+
            if (yasm__strcasecmp(vp->val, "align") == 0 && vp->param) {
                /*@dependent@*/ /*@null@*/ const yasm_intnum *align_expr;
                unsigned long bitcnt;
index aa335fdb7f8712e81e1235b287bb4d8f1ddf737b..4aa17b54413d0a6a001adeab0ed65a9cdffa8626 100644 (file)
@@ -1204,6 +1204,12 @@ coff_objfmt_section_switch(yasm_objfmt *objfmt, yasm_valparamhead *valparams,
 
        win32warn = 0;
 
+       if (!vp->val) {
+           yasm__warning(YASM_WARN_GENERAL, line,
+                         N_("Unrecognized numeric qualifier"));
+           continue;
+       }
+
        match = 0;
        for (i=0; i<NELEMS(flagquals) && !match; i++) {
            if (yasm__strcasecmp(vp->val, flagquals[i].name) == 0) {
index 8fd9f81ca2af7d9ad0e68b6137f711804593b76b..15bffaddd18510ad03a6b7821c5a488b5d0694af 100644 (file)
@@ -783,6 +783,12 @@ elf_objfmt_section_switch(yasm_objfmt *objfmt, yasm_valparamhead *valparams,
        size_t i;
        int match;
 
+       if (!vp->val) {
+           yasm__warning(YASM_WARN_GENERAL, line,
+                         N_("Unrecognized numeric qualifier"));
+           continue;
+       }
+
        match = 0;
        for (i=0; i<NELEMS(flagquals) && !match; i++) {
            if (yasm__strcasecmp(vp->val, flagquals[i].name) == 0) {
index 44d68ebe296c437aa8f8031f58e03785b021ec74..737adf33b25b4964973ca9c006212c24b17a6812 100644 (file)
@@ -675,6 +675,12 @@ xdf_objfmt_section_switch(yasm_objfmt *objfmt, yasm_valparamhead *valparams,
     sectname = vp->val;
 
     while ((vp = yasm_vps_next(vp))) {
+       if (!vp->val) {
+           yasm__warning(YASM_WARN_GENERAL, line,
+                         N_("Unrecognized numeric qualifier"));
+           continue;
+       }
+
        flags_override = 1;
        if (yasm__strcasecmp(vp->val, "use16") == 0) {
            flags &= ~(XDF_SECT_USE_32|XDF_SECT_USE_64);