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

Add op_fclose to keep fclose's type signature the same #31

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,17 @@ static opus_int64 op_ftell(void *_stream){
#endif
}

static int op_fclose(void *_stream){
/*This indirection maintains fclose's type signature which is necessary for
Control Flow Integrity.*/
return fclose((FILE *)_stream);
}

static const OpusFileCallbacks OP_FILE_CALLBACKS={
op_fread,
op_fseek,
op_ftell,
(op_close_func)fclose
op_fclose
};

#if defined(_WIN32)
Expand Down Expand Up @@ -257,7 +263,7 @@ static const OpusFileCallbacks OP_UNSEEKABLE_FILE_CALLBACKS={
op_fread,
op_fseek_fail,
op_ftell,
(op_close_func)fclose
op_fclose
};

# define WIN32_LEAN_AND_MEAN
Expand Down