Although the number type is nullable from the type definition of ATL, the lib might still normalize all unknown values to 0 which makes doing null check only not enough. Fallback to ffprobe results when the number is 0 as well.
We are still using `Subnet.Contains` a lot but that does not handle IPv4 mapped to IPv6 addresses at all. It was partially fixed by #12094 in local network checking, but it may not always happen on LAN.
Also make all local network checking to use IsInLocalNetwork method instead of just performing `Subnet.Contains` which is not accurate.
Filter out all link-local addresses for external interface matching.
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.