fix some oss-fuzz (#1213)
* 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.
This commit is contained in:
@ -242,7 +242,7 @@ static inline uint32_t rol32(uint32_t word, unsigned int shift)
|
|||||||
*/
|
*/
|
||||||
static inline uint32_t ror32(uint32_t word, unsigned int shift)
|
static inline uint32_t ror32(uint32_t word, unsigned int shift)
|
||||||
{
|
{
|
||||||
return (word >> shift) | (word << (32 - shift));
|
return (word >> shift) | (word << ((32 - shift) & 0x1f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3217,14 +3217,14 @@ static inline void gen_pcrel(DisasContext *ctx, int rs, int16_t imm)
|
|||||||
switch (MASK_OPC_PCREL_TOP5BITS(ctx->opcode)) {
|
switch (MASK_OPC_PCREL_TOP5BITS(ctx->opcode)) {
|
||||||
case OPC_AUIPC:
|
case OPC_AUIPC:
|
||||||
if (rs != 0) {
|
if (rs != 0) {
|
||||||
offset = imm << 16;
|
offset = ((target_ulong)imm) << 16;
|
||||||
addr = addr_add(ctx, ctx->pc, offset);
|
addr = addr_add(ctx, ctx->pc, offset);
|
||||||
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rs], addr);
|
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rs], addr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPC_ALUIPC:
|
case OPC_ALUIPC:
|
||||||
if (rs != 0) {
|
if (rs != 0) {
|
||||||
offset = imm << 16;
|
offset = ((target_ulong)imm) << 16;
|
||||||
addr = ~0xFFFF & addr_add(ctx, ctx->pc, offset);
|
addr = ~0xFFFF & addr_add(ctx, ctx->pc, offset);
|
||||||
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rs], addr);
|
tcg_gen_movi_tl(tcg_ctx, *cpu_gpr[rs], addr);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user