Files
test2/intern/cycles/test/util_ies_test.cpp
Sergey Sharybin d86d86f729 Fix heap buffer overflow in Cycles IES parser
The IES parser in Cycles would lead to heap buffer overflow error
when non-supported or invalid data is provided to it.

The error was caused by the way how stirng is copied to vector
skipping the last null-terminator. Later C-style string utilities
are used for parsing, and they expect the data to be null-terminated.

It is unclear why data needs to be stored as vector: storing it as
string simplifies initialization.

Easiest to reproduce the issue is to use Blender build with address
sanitizer enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/116752
2024-01-03 18:00:41 +01:00

19 lines
292 B
C++

/* SPDX-FileCopyrightText: 2011-2024 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "util/ies.h"
CCL_NAMESPACE_BEGIN
TEST(util_ies, invalid)
{
IESFile ies_file;
EXPECT_FALSE(ies_file.load("Hello, World!"));
}
CCL_NAMESPACE_END