mirror of https://github.com/odrling/Aegisub
Fix crash in PCM audio provider when using files larger than the mapping size (256 MB on 32 bit). The length of mappings closer than mapping-size to the end of the file, when the file was larger, would not be adjusted to not cross the end of file.
Originally committed to SVN as r2810.
This commit is contained in:
parent
49e3895180
commit
7a19b273b1
|
@ -178,7 +178,7 @@ char * PCMAudioProvider::EnsureRangeAccessible(int64_t range_start, int64_t rang
|
||||||
mapping_length = range_length;
|
mapping_length = range_length;
|
||||||
}
|
}
|
||||||
// But also make sure we don't try to make a mapping larger than the file
|
// But also make sure we don't try to make a mapping larger than the file
|
||||||
if ((int64_t)mapping_length > file_size)
|
if (mapping_start + (int64_t)mapping_length > file_size)
|
||||||
mapping_length = (size_t)(file_size - mapping_start);
|
mapping_length = (size_t)(file_size - mapping_start);
|
||||||
// We already checked that the requested range doesn't extend over the end of the file
|
// We already checked that the requested range doesn't extend over the end of the file
|
||||||
// Hopefully this should ensure that small files are always mapped in their entirety
|
// Hopefully this should ensure that small files are always mapped in their entirety
|
||||||
|
|
Loading…
Reference in New Issue