fix some oss-fuzz (#1224)
* fix oss-fuzz 18138. * fix oss-fuzz 20079. * fix oss-fuzz 20209. * fix oss-fuzz 20210. * fix oss-fuzz 20262. * rollback. * rollback. * fix oss-fuzz 20079. * fix oss-fuzz 20179. * fix oss-fuzz 20195. * fix oss-fuzz 20206. * fix oss-fuzz 20207. * fix oss-fuzz 20265. * fix oss-fuzz 20285. * fix oss-fuzz 20868. * fix oss-fuzz 20908. * fix oss-fuzz 20909. * fix oss-fuzz 20914. * fix oss-fuzz 20922. * fix oss-fuzz 20928. * remove warnigs. * fix oss-fuzz 20961. * fix oss-fuzz 21005. * remove clang warnings. * fix oss-fuzz 21043. * fix oss-fuzz 21047. * fix oss-fuzz 21050. * fix oss-fuzz 21219.
This commit is contained in:
parent
8ff326a2a3
commit
930cb9ada8
|
@ -608,7 +608,7 @@ NEON_POP(pmax_u16, neon_u16, 2)
|
|||
#undef NEON_FN
|
||||
|
||||
#define NEON_FN(dest, src1, src2) \
|
||||
dest = (src1 > src2) ? (src1 - src2) : (src2 - src1)
|
||||
dest = (src1 > src2) ? ((int64_t)src1 - (int64_t)src2) : ((int64_t)src2 - (int64_t)src1)
|
||||
NEON_VOP(abd_s8, neon_s8, 4)
|
||||
NEON_VOP(abd_u8, neon_u8, 4)
|
||||
NEON_VOP(abd_s16, neon_s16, 2)
|
||||
|
@ -1052,7 +1052,7 @@ uint64_t HELPER(neon_qrshl_u64)(CPUARMState *env, uint64_t val, uint64_t shiftop
|
|||
if (tmp >= (ssize_t)sizeof(src1) * 8) { \
|
||||
if (src1) { \
|
||||
SET_QC(); \
|
||||
dest = (1 << (sizeof(src1) * 8 - 1)); \
|
||||
dest = (uint32_t)(1U << (sizeof(src1) * 8 - 1)); \
|
||||
if (src1 > 0) { \
|
||||
dest--; \
|
||||
} \
|
||||
|
@ -1067,7 +1067,7 @@ uint64_t HELPER(neon_qrshl_u64)(CPUARMState *env, uint64_t val, uint64_t shiftop
|
|||
dest = ((uint64_t)src1) << tmp; \
|
||||
if ((dest >> tmp) != src1) { \
|
||||
SET_QC(); \
|
||||
dest = (uint32_t)(1 << (sizeof(src1) * 8 - 1)); \
|
||||
dest = (uint32_t)(1U << (sizeof(src1) * 8 - 1)); \
|
||||
if (src1 > 0) { \
|
||||
dest--; \
|
||||
} \
|
||||
|
@ -1133,7 +1133,7 @@ uint64_t HELPER(neon_qrshl_s64)(CPUARMState *env, uint64_t valop, uint64_t shift
|
|||
}
|
||||
} else {
|
||||
int64_t tmp = val;
|
||||
val <<= shift;
|
||||
val = (uint64_t)val << (shift & 0x3f);
|
||||
if ((val >> shift) != tmp) {
|
||||
SET_QC();
|
||||
val = (tmp >> 63) ^ ~SIGNBIT64;
|
||||
|
|
|
@ -6144,7 +6144,7 @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
|
|||
val = 0;
|
||||
for (n = 0; n < 4; n++) {
|
||||
if (imm & (1 << (n + (pass & 1) * 4)))
|
||||
val |= 0xff << (n * 8);
|
||||
val |= 0xffU << (n * 8);
|
||||
}
|
||||
tcg_gen_movi_i32(tcg_ctx, tmp, val);
|
||||
} else {
|
||||
|
@ -11127,7 +11127,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) // qq
|
|||
/* jump to the offset */
|
||||
val = (uint32_t)s->pc + 2;
|
||||
offset = ((int32_t)((uint32_t)insn << 24)) >> 24;
|
||||
val += offset << 1;
|
||||
val += (int32_t)((uint32_t)offset << 1);
|
||||
gen_jmp(s, val);
|
||||
break;
|
||||
|
||||
|
@ -11140,7 +11140,7 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) // qq
|
|||
/* unconditional branch */
|
||||
val = (uint32_t)s->pc;
|
||||
offset = ((int32_t)((uint32_t)insn << 21)) >> 21;
|
||||
val += (offset << 1) + 2;
|
||||
val += (int32_t)((uint32_t)offset << 1) + 2;
|
||||
gen_jmp(s, val);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1471,7 +1471,7 @@ void glue(helper_phsubd, SUFFIX)(CPUX86State *env, Reg *d, Reg *s)
|
|||
{
|
||||
d->L(0) = (int32_t)((int64_t)d->L(0) - (int64_t)d->L(1));
|
||||
XMM_ONLY(d->L(1) = (int32_t)((int64_t)d->L(2) - (int64_t)d->L(3)));
|
||||
d->L((1 << SHIFT) + 0) = (uint32_t)((int32_t)s->L(0) - (int32_t)s->L(1));
|
||||
d->L((1 << SHIFT) + 0) = (uint32_t)((int64_t)s->L(0) - (int64_t)s->L(1));
|
||||
XMM_ONLY(d->L(3) = (int32_t)s->L(2) - (int32_t)s->L(3));
|
||||
}
|
||||
|
||||
|
|
|
@ -210,8 +210,8 @@ void HELPER(divs)(CPUM68KState *env, uint32_t word)
|
|||
if (den == 0) {
|
||||
raise_exception(env, EXCP_DIV0);
|
||||
}
|
||||
quot = num / den;
|
||||
rem = num % den;
|
||||
quot = (int64_t)num / den;
|
||||
rem = (int64_t)num % den;
|
||||
flags = 0;
|
||||
if (word && quot != (int16_t)quot)
|
||||
flags |= CCF_V;
|
||||
|
|
|
@ -1170,7 +1170,7 @@ DISAS_INSN(bitop_im)
|
|||
bitnum &= 7;
|
||||
else
|
||||
bitnum &= 31;
|
||||
mask = 1 << bitnum;
|
||||
mask = 1U << bitnum;
|
||||
|
||||
tmp = tcg_temp_new(tcg_ctx);
|
||||
assert (CCF_Z == (1 << 2));
|
||||
|
|
|
@ -3394,7 +3394,7 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc, int rd, int rs, int rt)
|
|||
{
|
||||
TCGv t2 = tcg_temp_new(tcg_ctx);
|
||||
TCGv t3 = tcg_temp_new(tcg_ctx);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1LL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1ULL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, -1LL);
|
||||
tcg_gen_and_tl(tcg_ctx, t2, t2, t3);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, 0);
|
||||
|
@ -3411,7 +3411,7 @@ static void gen_r6_muldiv(DisasContext *ctx, int opc, int rd, int rs, int rt)
|
|||
{
|
||||
TCGv t2 = tcg_temp_new(tcg_ctx);
|
||||
TCGv t3 = tcg_temp_new(tcg_ctx);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1LL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1ULL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, -1LL);
|
||||
tcg_gen_and_tl(tcg_ctx, t2, t2, t3);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, 0);
|
||||
|
@ -3574,7 +3574,7 @@ static void gen_muldiv(DisasContext *ctx, uint32_t opc,
|
|||
{
|
||||
TCGv t2 = tcg_temp_new(tcg_ctx);
|
||||
TCGv t3 = tcg_temp_new(tcg_ctx);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1LL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t2, t0, -1ULL << 63);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, -1LL);
|
||||
tcg_gen_and_tl(tcg_ctx, t2, t2, t3);
|
||||
tcg_gen_setcondi_tl(tcg_ctx, TCG_COND_EQ, t3, t1, 0);
|
||||
|
@ -3983,7 +3983,7 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc,
|
|||
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rd], 0);
|
||||
tcg_gen_br(tcg_ctx, l3);
|
||||
gen_set_label(tcg_ctx, l1);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t0, -1LL << 63, l2);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t0, -1ULL << 63, l2);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t1, -1LL, l2);
|
||||
tcg_gen_mov_tl(tcg_ctx, *cpu_gpr[rd], t0);
|
||||
tcg_gen_br(tcg_ctx, l3);
|
||||
|
@ -4014,7 +4014,7 @@ static void gen_loongson_integer(DisasContext *ctx, uint32_t opc,
|
|||
int l2 = gen_new_label(tcg_ctx);
|
||||
int l3 = gen_new_label(tcg_ctx);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_EQ, t1, 0, l1);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t0, -1LL << 63, l2);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t0, -1ULL << 63, l2);
|
||||
tcg_gen_brcondi_tl(tcg_ctx, TCG_COND_NE, t1, -1LL, l2);
|
||||
gen_set_label(tcg_ctx, l1);
|
||||
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rd], 0);
|
||||
|
|
|
@ -132,7 +132,7 @@ int64_t strtosz_suffix_unit(const char *nptr, char **end,
|
|||
if (mul == 1 && mul_required) {
|
||||
goto fail;
|
||||
}
|
||||
if ((val * mul >= INT64_MAX) || val < 0) {
|
||||
if ((val * mul >= (double)INT64_MAX) || val < 0) {
|
||||
retval = -ERANGE;
|
||||
goto fail;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue