regress: fix code style

This commit is contained in:
Nguyen Anh Quynh 2015-08-28 18:21:36 +08:00
parent 5de0d5ca70
commit d957d1efee
5 changed files with 79 additions and 74 deletions

View File

@ -4,9 +4,10 @@
#include <stdlib.h>
#define UC_BUG_WRITE_SIZE 13000
#define UC_BUG_WRITE_ADDR 0x1000 // fix this by change this to 0x2000
#define UC_BUG_WRITE_ADDR 0x1000
int main() {
int main()
{
int size;
uint8_t *buf;
uch uh;

View File

@ -6,7 +6,8 @@
#define SIZE 1024*64
#define OVERFLOW 1
int main() {
int main()
{
uch uh;
uint8_t *buf, *buf2;
int i;

View File

@ -5,25 +5,25 @@
#include <unicorn/unicorn.h>
const uint8_t PROGRAM[] =
"\xeb\x1a\x58\x83\xc0\x04\x83\xe0\xfc\x83\xc0\x01\xc7\x00\x78\x56"
"\x34\x12\x83\xc0\x07\xc7\x00\x21\x43\x65\x87\x90\xe8\xe1\xff\xff"
"\xff" "xxxxAAAAxxxBBBB";
"\xeb\x1a\x58\x83\xc0\x04\x83\xe0\xfc\x83\xc0\x01\xc7\x00\x78\x56"
"\x34\x12\x83\xc0\x07\xc7\x00\x21\x43\x65\x87\x90\xe8\xe1\xff\xff"
"\xff" "xxxxAAAAxxxBBBB";
// total size: 33 bytes
/*
jmp short bottom
top:
pop eax
add eax, 4
and eax, 0xfffffffc
add eax, 1 ; unaligned
mov dword [eax], 0x12345678 ; try to write into code section
add eax, 7 ; aligned
mov dword [eax], 0x87654321 ; try to write into code section
nop
pop eax
add eax, 4
and eax, 0xfffffffc
add eax, 1 ; unaligned
mov dword [eax], 0x12345678 ; try to write into code section
add eax, 7 ; aligned
mov dword [eax], 0x87654321 ; try to write into code section
nop
bottom:
call top
*/
call top
*/
// callback for tracing instruction
static void hook_code(uch handle, uint64_t address, uint32_t size, void *user_data)
@ -72,7 +72,8 @@ static bool hook_mem_invalid(uch handle, uc_mem_type type,
#define STACK 0x500000
#define STACK_SIZE 0x5000
int main(int argc, char **argv, char **envp) {
int main(int argc, char **argv, char **envp)
{
uch handle, trace1, trace2;
uc_err err;
uint8_t bytes[8];

View File

@ -8,14 +8,16 @@
int got_sigill = 0;
void _interrupt(uch handle, uint32_t intno, void *user_data) {
void _interrupt(uch handle, uint32_t intno, void *user_data)
{
if (intno == 6) {
uc_emu_stop (handle);
got_sigill = 1;
}
}
int main() {
int main()
{
int size;
uint8_t *buf;
uch uh;