Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't crash when there are no "untwine bits". #151

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions epf/EpfTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ constexpr int NumFileProcessors = 8;
struct FileInfo
{
FileInfo() :
numPoints(0), start(0), untwineBitsDim(pdal::Dimension::Id::Unknown), fileVersion(0)
numPoints(0), start(0), untwineBitsOffset(-1), fileVersion(0)
{}

std::string filename;
Expand All @@ -52,7 +52,6 @@ struct FileInfo
uint64_t start;
pdal::BOX3D bounds;
pdal::SpatialReference srs;
pdal::Dimension::Id untwineBitsDim;
int untwineBitsOffset;
// Currently only set for LAS files.
int fileVersion;
Expand Down
6 changes: 4 additions & 2 deletions epf/FileProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ class StdPointProcessor : public BasePointProcessor
}

// We pack all the bitfields into the "untwine bits" field.
memcpy(dst.data() + m_fi.untwineBitsOffset, &untwineBits, 1);
if (m_fi.untwineBitsOffset > -1)
memcpy(dst.data() + m_fi.untwineBitsOffset, &untwineBits, 1);
}
};

Expand Down Expand Up @@ -121,7 +122,8 @@ class LegacyLasPointProcessor : public BasePointProcessor
}

// We pack all the bitfields into the "untwine bits" field.
memcpy(dst.data() + m_fi.untwineBitsOffset, &untwineBits, 1);
if (m_fi.untwineBitsOffset > -1)
memcpy(dst.data() + m_fi.untwineBitsOffset, &untwineBits, 1);
}
};

Expand Down
Loading