Skip to content

Commit c8b7fb1

Browse files
committed
fixup!: work around shared LIEF 1.0.0 link failure
Avoid the hidden ok_error_t bool conversion in shared LIEF 1.0.0 by checking the PE builder output instead. Restrict the workaround to 1.0.0 so other versions retain the existing return-value check. Refs: lief-project/LIEF#1387 Assisted-by: Codex Signed-off-by: inoway46 <inoueyuya416@gmail.com>
1 parent 6a9b5b4 commit c8b7fb1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/node_sea_bin.cc‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,15 @@ InjectOutput InjectIntoPE(const std::vector<uint8_t>& executable,
306306
cfg.resources = true;
307307
cfg.rsrc_section = ".rsrc"; // ensure section name
308308
LIEF::PE::Builder builder(*binary, cfg);
309+
#if LIEF_VERSION_MAJOR == 1 && LIEF_VERSION_MINOR == 0 && \
310+
LIEF_VERSION_PATCH == 0
311+
// LIEF 1.0.0 does not export the result's bool conversion in shared builds.
312+
// https://github.com/lief-project/LIEF/issues/1387
313+
builder.build();
314+
if (builder.get_build().empty()) {
315+
#else
309316
if (!builder.build()) {
317+
#endif
310318
return {InjectResult::kError, {}, "Failed to build modified PE binary"};
311319
}
312320

0 commit comments

Comments
 (0)