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

segmentation fault in read_slice_layer_rbsp #44

Open
Serjyk opened this issue Sep 8, 2021 · 1 comment
Open

segmentation fault in read_slice_layer_rbsp #44

Serjyk opened this issue Sep 8, 2021 · 1 comment

Comments

@Serjyk
Copy link

Serjyk commented Sep 8, 2021

Hello. I caught a segmentation fault while working with an H264 video. This happens after calling the methods
find_nal_unit(...) and read_nal_unit(...) with the next set of bytes in hex:
"00000001419a246c437ffea7840000030000097800000001"

Application crashes in class h264_stream.c of method read_slice_layer_rbsp(...). Variable slice_data->rbsp_size is equal to negative value when we perform memcpy(...).

@MitchellHansen
Copy link

I had a similar problem, try using the read_debug_nal_unit and see if it still crashes. There appears to be some desync between the debug/non-debug code.

If that fixes it for you, modifying read_nal_unit to match read_debug_nal_unit was all that was needed to fix it (for me)

        if ( slice_data->rbsp_size > 0 )
        {
            slice_data->rbsp_buf = (uint8_t*)malloc(slice_data->rbsp_size);
            memcpy( slice_data->rbsp_buf, sptr, slice_data->rbsp_size );
            // ugly hack: since next NALU starts at byte border, we are going to be padded by trailing_bits;
            return;
        }
        else
        {
            slice_data->rbsp_buf = NULL;
            slice_data->rbsp_size = 0;
        }

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