Skip to content

Commit

Permalink
fix undefined behaviour when loading control file (#1466)
Browse files Browse the repository at this point in the history
#911 introduced using the wrong signature and
this UB was missed in review amidst the thousands of lines of changes.

Signed-off-by: usamoi <usamoi@outlook.com>
  • Loading branch information
usamoi authored Jan 8, 2024
1 parent 7df371d commit 12bb9ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cargo-pgrx/src/command/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,12 @@ pub(crate) fn generate_schema(
.wrap_err_with(|| format!("Couldn't libload {}", lib_so.display()))?;

let symbol: libloading::os::unix::Symbol<
unsafe extern "Rust" fn() -> eyre::Result<pgrx_sql_entity_graph::ControlFile>,
unsafe extern "Rust" fn(_: ()) -> pgrx_sql_entity_graph::ControlFile,
> = lib
.get("__pgrx_marker".as_bytes())
.expect("Couldn't call __pgrx_marker");
let control_file_entity = pgrx_sql_entity_graph::SqlGraphEntity::ExtensionRoot(
symbol().expect("Failed to get control file information"),
symbol(()),
);
entities.push(control_file_entity);

Expand Down

0 comments on commit 12bb9ad

Please sign in to comment.