New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ragg2 gives incorrect input when using -d -w #7

Closed
ericfode opened this Issue Aug 1, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@ericfode

ericfode commented Aug 1, 2012

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141

@ericfode

This comment has been minimized.

ericfode commented Aug 1, 2012

Working on this... It looks like this block of code is the problem
libr\util\num.c:96

} else {
        lch = str[len>0?len-1:0];
        if (*str=='0' && lch != 'b' && lch != 'h')
            lch = 'o';
        switch (lch) {
        case 'h': // hexa
            sscanf (str, "%"PFMT64x"", &ret);
            break;
        case 'o': // octal
            sscanf (str, "%"PFMT64o"", &ret);
            break;
        case 'b': // binary
            ret = 0;
            for (j=0, i=strlen (str)-2; i>=0; i--, j++) {
                if (str[i]=='1') ret|=1<<j;
                else if (str[i]!='0') break;
            }
@radare

This comment has been minimized.

Owner

radare commented Aug 2, 2012

Works fine here. Are you using the git repo or the stable release?

Thanks

On Aug 2, 2012, at 1:14, Eric Fodereply@reply.github.com wrote:

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141


Reply to this email directly or view it on GitHub:
#7

@ericfode

This comment has been minimized.

ericfode commented Aug 2, 2012

git repo (just did a git pull to make sure i had the most recent version)

@radare

This comment has been minimized.

Owner

radare commented Aug 2, 2012

You are right. This is a bug. I have puhed a fix. Let me know if its correct for you.

Thx

On Aug 2, 2012, at 1:14, Eric Fodereply@reply.github.com wrote:

if the last character is of the replacement is b it always gets put at the beginning of the string regardless of where you told it to go.

root@protostar:# ragg2 -p A200 -d 50:0xccccccb
cbcccc0c41414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:
# ragg2 -p A200 -d 50:0xcb
cb00000041414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141
root@protostar:# ragg2 -p A10 -d 50:0xcb
cb000000414141414141
root@protostar:
# ragg2 -p A20 -w 10:cb
cb41414141414141414141414141414141414141


Reply to this email directly or view it on GitHub:
#7

@ericfode ericfode closed this Aug 2, 2012

@ericfode ericfode reopened this Aug 2, 2012

@ericfode

This comment has been minimized.

ericfode commented Aug 2, 2012

Works for me

@ericfode ericfode closed this Aug 2, 2012

@ghost ghost referenced this issue Oct 22, 2013

Closed

Sigsegv while saving project #290

@ghost ghost referenced this issue Nov 12, 2013

Closed

This file makes r2 feels bad #346

@radare radare referenced this issue Feb 17, 2014

Closed

/R segfaults #638

@radare radare referenced this issue Sep 27, 2014

Closed

pd 100% cpu #1441

This was referenced Jul 12, 2018

@radare radare referenced this issue Sep 5, 2018

Closed

memory leaks #11389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment