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

Fix data races in stbir_resize_extended_split by moving the call to s… #1569

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions stb_image_resize2.h
Original file line number Diff line number Diff line change
Expand Up @@ -7636,7 +7636,12 @@ STBIRDEF int stbir_build_samplers_with_splits( STBIR_RESIZE * resize, int splits
stbir_free_samplers( resize );

resize->called_alloc = 1;
return stbir__perform_build( resize, splits );
splits = stbir__perform_build( resize, splits );

// update anything that can be changed without recalcing samplers
stbir__update_info_from_resize( resize->samplers, resize );

return splits;
}

STBIR_PROFILE_BUILD_CLEAR( resize->samplers );
Expand Down Expand Up @@ -7711,9 +7716,6 @@ STBIRDEF int stbir_resize_extended_split( STBIR_RESIZE * resize, int split_start

if ( ( split_start >= resize->splits ) || ( split_start < 0 ) || ( ( split_start + split_count ) > resize->splits ) || ( split_count <= 0 ) )
return 0;

// update anything that can be changed without recalcing samplers
stbir__update_info_from_resize( resize->samplers, resize );

// do resize
return stbir__perform_resize( resize->samplers, split_start, split_count );
Expand Down