mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 23:20:40 +00:00
Fix more sign bugs spotted by vs (#18990)
This commit is contained in:
parent
4860de6948
commit
18011597c4
@ -4127,7 +4127,7 @@ Operand_simm7_decode (uint32 *valp)
|
||||
{
|
||||
ut32 imm7_0 = *valp & 0x7f;
|
||||
// warning C4146: unary minus operator applied to unsigned type
|
||||
ut32 simm7_0 = (ut32)((((-((((imm7_0 >> 6) & 1)) & (((imm7_0 >> 5) & 1)))) & 0x1ffffff)) << 7) | imm7_0;
|
||||
ut32 simm7_0 = (ut32)((((-(st64)((((imm7_0 >> 6) & 1)) & (((imm7_0 >> 5) & 1)))) & 0x1ffffff)) << 7) | imm7_0;
|
||||
*valp = simm7_0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -612,16 +612,16 @@ static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc
|
||||
case EM_386: switch (rel->type) {
|
||||
case R_386_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE.
|
||||
case R_386_32: ADD(32, 0);
|
||||
case R_386_PC32: ADD(32,-P);
|
||||
case R_386_PC32: ADD(32,-(st64)P);
|
||||
case R_386_GLOB_DAT: SET(32);
|
||||
case R_386_JMP_SLOT: SET(32);
|
||||
case R_386_RELATIVE: ADD(32, B);
|
||||
case R_386_GOTOFF: ADD(32, -got_addr);
|
||||
case R_386_GOTOFF: ADD(32, -(st64)got_addr);
|
||||
case R_386_GOTPC: ADD(32, got_addr - P);
|
||||
case R_386_16: ADD(16, 0);
|
||||
case R_386_PC16: ADD(16,-P);
|
||||
case R_386_PC16: ADD(16,-(st64)P);
|
||||
case R_386_8: ADD(8, 0);
|
||||
case R_386_PC8: ADD(8, -P);
|
||||
case R_386_PC8: ADD(8, -(st64)P);
|
||||
case R_386_COPY: ADD(32, 0); // XXX: copy symbol at runtime
|
||||
case R_386_IRELATIVE: r->is_ifunc = true; SET(32);
|
||||
default: break;
|
||||
@ -630,19 +630,19 @@ static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc
|
||||
case EM_X86_64: switch (rel->type) {
|
||||
case R_X86_64_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE.
|
||||
case R_X86_64_64: ADD(64, 0);
|
||||
case R_X86_64_PLT32: ADD(32,-P /* +L */);
|
||||
case R_X86_64_PLT32: ADD(32,-(st64)P /* +L */);
|
||||
case R_X86_64_GOT32: ADD(32, got_addr);
|
||||
case R_X86_64_PC32: ADD(32,-P);
|
||||
case R_X86_64_PC32: ADD(32,-(st64)P);
|
||||
case R_X86_64_GLOB_DAT: r->vaddr -= rel->sto; SET(64);
|
||||
case R_X86_64_JUMP_SLOT: r->vaddr -= rel->sto; SET(64);
|
||||
case R_X86_64_RELATIVE: ADD(64, B);
|
||||
case R_X86_64_32: ADD(32, 0);
|
||||
case R_X86_64_32S: ADD(32, 0);
|
||||
case R_X86_64_16: ADD(16, 0);
|
||||
case R_X86_64_PC16: ADD(16,-P);
|
||||
case R_X86_64_PC16: ADD(16,-(st64)P);
|
||||
case R_X86_64_8: ADD(8, 0);
|
||||
case R_X86_64_PC8: ADD(8, -P);
|
||||
case R_X86_64_GOTPCREL: ADD(64, got_addr-P);
|
||||
case R_X86_64_PC8: ADD(8, -(st64)P);
|
||||
case R_X86_64_GOTPCREL: ADD(64, got_addr - P);
|
||||
case R_X86_64_COPY: ADD(64, 0); // XXX: copy symbol at runtime
|
||||
case R_X86_64_IRELATIVE: r->is_ifunc = true; SET(64);
|
||||
default: break;
|
||||
@ -652,14 +652,14 @@ static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc
|
||||
switch (rel->type) {
|
||||
case R_ARM_NONE: break;
|
||||
case R_ARM_ABS32: ADD(32, 0);
|
||||
case R_ARM_REL32: ADD(32,-P);
|
||||
case R_ARM_REL32: ADD(32,-(st64)P);
|
||||
case R_ARM_ABS16: ADD(16, 0);
|
||||
case R_ARM_ABS8: ADD(8, 0);
|
||||
case R_ARM_SBREL32: ADD(32, -B);
|
||||
case R_ARM_SBREL32: ADD(32, -(st64)B);
|
||||
case R_ARM_GLOB_DAT: ADD(32, 0);
|
||||
case R_ARM_JUMP_SLOT: ADD(32, 0);
|
||||
case R_ARM_RELATIVE: ADD(32, B);
|
||||
case R_ARM_GOTOFF: ADD(32,-got_addr);
|
||||
case R_ARM_GOTOFF: ADD(32,-(st64)got_addr);
|
||||
default: ADD(32, got_addr); break; // reg relocations
|
||||
}
|
||||
break;
|
||||
|
@ -5673,7 +5673,7 @@ static void demo_begin(RCore *core, RConsCanvas *can) {
|
||||
r_str_ansi_filter (s, NULL, NULL, -1);
|
||||
int i, h, w = r_cons_get_size (&h);
|
||||
for (i = 0; i < 40; i+= (1 + (i/30))) {
|
||||
int H = i * ((double)h / 40);
|
||||
int H = (int)(i * ((double)h / 40));
|
||||
char *r = r_str_scale (s, w, H);
|
||||
r_cons_clear00 ();
|
||||
r_cons_gotoxy (0, (h / 2) - (H / 2));
|
||||
|
@ -36,14 +36,14 @@ in(B),t=c*h*g-f* e;int x=40+30*D*
|
||||
// global iterators
|
||||
R_API char *r_str_donut(int osize) {
|
||||
int size = osize;
|
||||
static float A= 0;
|
||||
static float B= 0;
|
||||
float i,j,z[1760];
|
||||
static double A= 0;
|
||||
static double B= 0;
|
||||
double i,j,z[1760];
|
||||
int k;
|
||||
char b[1760];
|
||||
char o[1760];
|
||||
memset (b,32,1760);
|
||||
memset (z,0,7040) ;
|
||||
memset (b, 32, 1760);
|
||||
memset (z, 0, 7040) ;
|
||||
if (osize == 0) {
|
||||
size = 100;
|
||||
} else {
|
||||
@ -65,11 +65,11 @@ R_API char *r_str_donut(int osize) {
|
||||
float g = cos (A);
|
||||
float h = d + 2;
|
||||
float D = 1 / (c* h*e+f*g+5),l=cos(i),m=cos(B),n=sin(B),t=c*h*g-f*e;
|
||||
int x = Align+Width*D*(l*h*m-t*n);
|
||||
int y = 12 + Height*D*(l*h*n +t*m);
|
||||
int x = (int)(Align+Width*D*(l*h*m-t*n));
|
||||
int y = (int)(12 + Height*D*(l*h*n +t*m));
|
||||
int o = x + 80 * y;
|
||||
int N = 8*((f*e-c*d*g)*m-c*d*e-f*g-l*d*n);
|
||||
if (22 >y && y > 0 && x > 0 && 80 >x && D > z[o]) {
|
||||
int N = (int)(8*((f*e-c*d*g)*m-c*d*e-f*g-l*d*n));
|
||||
if (22 >y && y > 0 && x > 0 && 80 > x && D > z[o]) {
|
||||
z[o] = D;
|
||||
b[o] = " .,-:!/|S$@&"[N > 0? N: 0];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user