Skip to content

player/screenshot: %tX template format fixes#17671

Open
na-na-hi wants to merge 4 commits intompv-player:masterfrom
na-na-hi:screenshot-time-fix
Open

player/screenshot: %tX template format fixes#17671
na-na-hi wants to merge 4 commits intompv-player:masterfrom
na-na-hi:screenshot-time-fix

Conversation

@na-na-hi
Copy link
Copy Markdown
Contributor

Fixes UB in some cases and allows %ts (unix timestamp) date format available on all platforms.

localtime can fail and return NULL, which causes NULL dereference
for strftime.
The format specifier is controlled by the user that can be arbitrary
character. Using invalid specifier in strftime is UB. Fix this by only
accepting the specifiers recognized in C11.

Partial compatibility is provided for extension formats k, l, P by
translating them to the closest standard alternative.
Previous commit left the common %s format extension unresolved.
This implements the format in a platform independent way so it can be
used on all platforms, including on Windows where strftime does not
support %s.
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