Skip to content

Fix GH-10344: imagettfbbox(): Could not find/open font UNC path #13241

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

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

libgd uses an incorrect absolute path check in gdft.c. It checks if either the path starts with a '/' (only valid on Posix btw), or whether it contains something of the form C:\ or C:/. However, this overlooks the possibility of using UNC paths on Windows. As we already do PHP-specific stuff with VCWD_ macros, use IS_ABSOLUTE_PATH to check for an absolute path which will take into account UNC paths as well.

libgd uses an incorrect absolute path check in gdft.c.
It checks if either the path starts with a '/' (only valid on Posix
btw), or whether it contains something of the form C:\ or C:/.
However, this overlooks the possibility of using UNC paths on Windows.
As we already do PHP-specific stuff with VCWD_ macros, use
IS_ABSOLUTE_PATH to check for an absolute path which will take into
account UNC paths as well.
@nielsdos nielsdos linked an issue Jan 24, 2024 that may be closed by this pull request
@devnexen
Copy link
Member

no hope to push it upstream I see :)

@nielsdos
Copy link
Member Author

no hope to push it upstream I see :)

Indeed.
But even if it was upstreamable, the previous fix I did took a long time to merge... libgd feels unmaintained.
Which reminds me that I need to backport that one fix to php, I'll put it on my todo list for this week.

@nielsdos nielsdos requested review from devnexen and Girgias January 25, 2024 17:20
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know much about paths and Windows, but this looks reasonable?

Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, I m surprised there is still a netware code path :)

@nielsdos
Copy link
Member Author

Looks good to me, I m surprised there is still a netware code path :)

Never really heard of it, Wikipedia says "Final release: 6 May 2009; 14 years ago", so perhaps can be removed from the master branch, but 🤷

@nielsdos nielsdos closed this in 4a48729 Jan 25, 2024
@cmb69
Copy link
Member

cmb69 commented Jan 27, 2025

Found this while looking into https://bugs.php.net/75656.

no hope to push it upstream I see :)

Hmm, that would certainly be bad, since the goal should still be to unbundle libgd (the only somewhat sensible alternative would be to drop support for external libgd, but that ship probably has sailed long ago).

Anyway, the respective code is now in font_path(), and had been changed long ago to not only cater to absolute paths, but also to relative paths, but see libgd/libgd#952. I think bundled libgd should also handle it this way (does not necessarily work for ZTS, but this is a different issue).

I m surprised there is still a netware code path :)

See #17596.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

imagettfbbox(): Could not find/open font UNC path
4 participants