Skip to content

depends: Bump dlfcn-win32 to v1.4.2#61

Merged
garbear merged 1 commit intoPiersfrom
update-dlfcn-win32
Mar 11, 2026
Merged

depends: Bump dlfcn-win32 to v1.4.2#61
garbear merged 1 commit intoPiersfrom
update-dlfcn-win32

Conversation

@garbear
Copy link
Member

@garbear garbear commented Mar 4, 2026

Description

As title says, I bumped dlfcn-win32 to v1.4.2.

Notable changes:

  • CMake 4.0 support was added in v1.4.2 (dropped our CMake policy patches)
  • Windows ARM64 support was added in v1.4.0.

dlfcn-win32 fork

I rebased the windows UWP patch, but it crashes patch.exe on Azure, so I forked the dlfcn-win32 repo and tagged v1.4.2 with Alwin's commit.

Error on azure was:

Performing patch step for 'dlfcn-win32'
patching file src/dlfcn.c
Assertation failed!

Program: C:\Strawberry\c\bin\patch.exe
File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354

Expression: hunk
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-mkdir.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-download.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-update.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-patch.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-configure.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-build.rule;D:\a\1\s\build\CMakeFiles\ff81d8f751455c61eb06ec168b49c1e8\dlfcn-win32-install.rule;D:\a\1\s\build\CMakeFiles\b92e65488deb09c80c81783db8877d8a\dlfcn-win32-complete.rule;D:\a\1\s\build\CMakeFiles\2519d97468e2ef66918e641805db7c70\dlfcn-win32.rule;D:\a\1\kodi\cmake\addons\CMakeLists.txt' exited with code 3. [D:\a\1\s\build\dlfcn-win32.vcxproj]

Then in the depends file I set the repo to my fork + the commit:

dlfcn-win32 https://github.com/garbear/dlfcn-win32/archive/refs/tags/v1.4.2-uwp2.tar.gz

How has this been tested?

Compile-tested on Windows 10 x64. Runtime testing in progress.

Other add-ons

The following add-ons use dlfcn-win32 and should be updated:

@kodiai
Copy link

kodiai bot commented Mar 4, 2026

Kodiai Review Summary

What Changed

Bumps dlfcn-win32 from v1.2.0 to v1.4.2, adds widechar support patch for Windows, and switches windowsstore to a forked repo with UWP patches included (eliminating the need for local patches).

Reviewed: core logic, docs

Strengths

  • ✅ Successfully eliminates CMake policy patches by upgrading to v1.4.2 which includes CMake 4.0 support
  • ✅ Adds .gitattributes to prevent LF/CRLF corruption of patch files, which is a robust solution for cross-platform development

Observations

Impact

[MAJOR] depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch (22): Missing null pointer check after malloc
Causes crash when memory allocation fails - lpFileNameW is used without verification that malloc succeeded

[MAJOR] depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch (23): Second MultiByteToWideChar not validated
Conversion errors pass undetected - if the second call returns 0, lpFileNameW contains uninitialized data passed to LoadLibraryExW

[MEDIUM] depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch (22-28): Memory leak when malloc succeeds but conversion fails
Memory allocated at line 22 is never freed when the second MultiByteToWideChar fails, because only the else branch (wide_len <= 0) is handled

Suggestions

  • Optional: Consider adding a comment explaining why windowsstore uses a forked repo (patch.exe crashes on Azure) to help future maintainers understand the approach
  • Future consideration: After other add-ons are updated, coordinate a consolidated update across the ecosystem to ensure consistency

Verdict

🔴 Address before merging -- 3 blocking issue(s) found (CRITICAL/MAJOR)

Review Details
  • Files reviewed: 7
  • Lines changed: +44 -155
  • Profile: balanced (auto, lines changed: 199)
  • Author: core (adapted tone)
  • Findings: 0 critical, 2 major, 1 medium, 0 minor (includes 3 from summary observations)
  • Review completed: 2026-03-04T07:24:07.928Z
  • Keyword parsing: No keywords detected

@garbear garbear force-pushed the update-dlfcn-win32 branch from d6ee03b to 7ba0652 Compare March 11, 2026 00:14
@garbear garbear merged commit 734aac9 into Piers Mar 11, 2026
10 checks passed
@garbear garbear deleted the update-dlfcn-win32 branch March 11, 2026 13:41
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

Successfully merging this pull request may close these issues.

1 participant