Skip to content

Commit

Permalink
safety check.
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jan 9, 2024
1 parent 68257fa commit 9c48f4b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mdim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ List CPL_read_mdim(CharacterVector file, CharacterVector array_names, CharacterV
for (const auto &co: components) {
auto t(co->GetType());
if (t.GetClass() == GEDTC_NUMERIC) {
if (t.GetSize() != sizeof(double))
stop("only Float64 data supported in numeric compounds");
NumericVector vec(nValues);
for (int j = 0; j < nValues; j++)
memcpy(&(vec[j]), v + j * sz + co->GetOffset(), sizeof(double));
Expand Down

0 comments on commit 9c48f4b

Please sign in to comment.