Skip to content

Commit e2e2850

Browse files
committed
Fix:Validated the dataWindow parameter before processing. Now, invalid values are caught and handled without crashing the program.
The changes were reversed back to commit 930b4c5 before applying this fix to remove unwanted formatting and keep the commit clean. Signed-off-by: haseeb khan <[email protected]>
1 parent 930b4c5 commit e2e2850

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/wrappers/python/PyOpenEXR.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,31 @@ PyFile::write(const char* outfilename)
10421042
{
10431043
auto name = py::str(a.first);
10441044
py::object second = py::cast<py::object>(a.second);
1045-
insertAttribute(header, name, second);
1045+
if (std::string (name) == "compression")
1046+
{
1047+
header.compression () = second.cast<Compression> ();
1048+
}
1049+
else if (std::string (name) == "type")
1050+
{
1051+
header.setType (second.cast<std::string> ());
1052+
}
1053+
else if (std::string (name) == "lineOrder")
1054+
{
1055+
header.lineOrder () = second.cast<LineOrder> ();
1056+
}
1057+
else if (std::string (name) == "tiles")
1058+
{
1059+
header.setTileDescription (second.cast<TileDescription> ());
1060+
}
1061+
else if (std::string (name) == "dataWindow")
1062+
{
1063+
header.dataWindow () = second.cast<Box2i> ();
1064+
}
1065+
else
1066+
{
1067+
// Handle other attributes
1068+
insertAttribute (header, name, second);
1069+
}
10461070
}
10471071

10481072
//

0 commit comments

Comments
 (0)