Skip to content

fix(ijkplayer): fix address overflow#5524

Open
th1nk3r-ing wants to merge 1 commit intobilibili:masterfrom
th1nk3r-ing:patch-1
Open

fix(ijkplayer): fix address overflow#5524
th1nk3r-ing wants to merge 1 commit intobilibili:masterfrom
th1nk3r-ing:patch-1

Conversation

@th1nk3r-ing
Copy link
Copy Markdown

It would cause overflow when the highest bit of the address is 1. So, we should using strtoull, not strtoll

It would cause overflow when the highest bit of the address is 1.
So, we should using `strtoull`, not `strtoll`
@th1nk3r-ing
Copy link
Copy Markdown
Author

The test code is :

int main(void)
{
    const char *pStr = "0xb400007896140dc0";
    uint64_t out = strtoull(pStr, NULL, 0);
    uint64_t out1 = strtoll(pStr, NULL, 0);

    printf("[%s %d] pStr:[%s], strtoll:[0x%"PRIx64"], strtoull:[0x%"PRIx64"]",
        __func__, __LINE__, pStr, out1, out);
    return 0;
}

result : [main 13] pStr:[0xb400007896140dc0], strtoll:[0x7fffffffffffffff], strtoull:[0xb400007896140dc0]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant