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
19 lines
292 B
C++
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
|