Christoph, I tried cherry-picking the commit you mentioned. It needed to be rebased slightly. It did not fix my test case: Use geeqie to open the autumn image from upstream issue 933
I pushed my change to the wip/10421242 branch of https://salsa.debian.org/multimedia-team/libheif if someone wants to do a test build. Thank you, Jeremy Bícha