stabs-dbgfmt.c: Check for overflow, cast to unsigned short.
svn path=/trunk/yasm/; revision=1729
{
yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
if (yasm__strcasecmp(var, "mode_bits") == 0)
- arch_x86->mode_bits = val;
+ arch_x86->mode_bits = (unsigned char)val;
else if (yasm__strcasecmp(var, "force_strict") == 0)
- arch_x86->force_strict = val;
+ arch_x86->force_strict = (unsigned char)val;
else
return 1;
return 0;
if (num_segregs > 1)
yasm_warn_set(YASM_WARN_GENERAL,
N_("multiple segment overrides, using leftmost"));
- insn->special_prefix = segregs[num_segregs-1]>>8;
+ insn->special_prefix = (unsigned char)(segregs[num_segregs-1]>>8);
} else if (num_segregs > 0)
yasm_internal_error(N_("unhandled segment prefix"));
}
}
-
-
/* initial pseudo-stab */
stab = yasm_xmalloc(sizeof(stabs_stab));
dbgbc = yasm_bc_create_common(&stabs_bc_stab_callback, stab, 0);
stab->bcstr = filebc;
stab->type = N_UNDF;
stab->other = 0;
- stab->desc = info.stabcount;
+ if (info.stabcount > 0xffff) {
+ yasm_warn_set(YASM_WARN_GENERAL, N_("over 65535 stabs"));
+ yasm_errwarn_propagate(errwarns, 0);
+ stab->desc = 0xffff;
+ } else
+ stab->desc = (unsigned short)info.stabcount;
}
static int