mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-26 18:30:56 +01:00
gl_shader_disk_cache: Check LZ4 size limit
Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
This commit is contained in:
parent
9f0b247cf6
commit
d0ac624403
1 changed files with 4 additions and 0 deletions
|
@ -53,6 +53,10 @@ ShaderCacheVersionHash GetShaderCacheVersionHash() {
|
|||
|
||||
template <typename T>
|
||||
std::vector<u8> CompressData(const T* source, std::size_t source_size) {
|
||||
if (source_size > LZ4_MAX_INPUT_SIZE) {
|
||||
// Source size exceeds LZ4 maximum input size
|
||||
return {};
|
||||
}
|
||||
const auto source_size_int = static_cast<int>(source_size);
|
||||
const int max_compressed_size = LZ4_compressBound(source_size_int);
|
||||
std::vector<u8> compressed(max_compressed_size);
|
||||
|
|
Loading…
Reference in a new issue