When writing an image to the disk, we use the completion of the async task as a signal indicating the completion of a write operation. However, this approach may not be entirely accurate, as the operating system can optimize IO operations by writing data to an intermediate cache instead of directly to the disk before completing the operation. This optimization can lead to a data race for our scanner, as subsequent tasks such as blurhash computation may attempt to read a file that has not yet been flushed from the volatile cache. Consequently, the data within the file becomes invalid, causing the blurhash computation task to fail.
Use WriteThrough mode to ensure the data is actual on disk before return to resolve this issue.
`SubtitleFormat`'s `LoadSubtitle()` function is
not thread-safe.
A `SubtitleEditParser` instance's `Parse()`
function can be called from multiple threads at
the same time.
`SubtitleFormat`s are cached in the constructor
of each `SubtitleEditParser`, and the same
instances are used for each possibly parallel
`Parse()` function call, which causes subtitle
parse problems.
This patch modifies the code, so we only cache
the extension -> `SubtitleFormat` type/class
mapping and create a new `SubtitleFormat`
instance in each `Parse()` call, so no
`SubtitleFormat` instance is accessed from
multiple threads.
Fixes#12113
Kudos for everyone investigating the issue there,
most notably @RenV123 for PoC-ing the solution.
Signed-off-by: Attila Szakacs <szakacs.attila96@gmail.com>
Our `GetFileSystemEntries` method will throw when enumerating the file system, but its callers might consider the unhandled exceptions as the whole path is not available. This would cause a single problematic file to fail the enumeration, and could lead to unexpected side effects.
HandleIOException gracefully by marking the files throwing as not exist to let the caller skip that file.
Our custom parameters are slower than the ultrafast preset, but users would expect encoding to be as fast as possible when selecting ultrafast. Only apply those parameters to superfast and slower presets.
We cannot simply use the subnet list to check if the IP is in LAN as it does not handle special cases like IPv4MappedToIPv6 and IPv6 loopback addresses.
Transcoding HDR video without tonemapping results
in an unacceptable viewing experience. Many users
are not even aware of the option and therefore we
should always enable the software tonemapx filter.
Signed-off-by: nyanmisaka <nst7999610810@gmail.com>