2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

gl_shader_disk_cache: Check LZ4 size limit

Co-Authored-By: ReinUsesLisp <reinuseslisp@airmail.cc>
This commit is contained in:
Frederic L 2019-02-03 01:22:01 -03:00 committed by ReinUsesLisp
parent 9f0b247cf6
commit d0ac624403

View file

@ -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);