Skip to content
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

SegmentFault in jfif_encode at jfif.c:842 #14

Closed
sleicasper opened this issue Dec 17, 2019 · 1 comment
Closed

SegmentFault in jfif_encode at jfif.c:842 #14

sleicasper opened this issue Dec 17, 2019 · 1 comment

Comments

@sleicasper
Copy link

run ffjpeg -e poc.bmp in linux

result in gdb.

Stopped reason: SIGSEGV
0x0000000000401968 in bitstr_tell (stream=0x0) at bitstr.c:221
221	    int type = *(int*)stream;
gdb-peda$

steam is a pointer which is null in this case. Dereferencing null pointer cause segment fault.

fix:

long bitstr_tell(void *stream)
{
    if( stream == NULL ){
        return EOF;
    }
    int type = *(int*)stream;
    switch (type) {
    case BITSTR_MEM : return mbitstr_tell(stream);
    case BITSTR_FILE: return fbitstr_tell(stream);
    }
    return EOF;
}

poc.zip

@rockcarry
Copy link
Owner

a new commit pushed for this issue, please check an test.

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

No branches or pull requests

2 participants