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

Adds a check for when CreateFileMappingA fails #2146

Merged
merged 2 commits into from
Dec 13, 2017

Conversation

StephenNneji
Copy link
Contributor

CreateFileMappingA returns a NULL handle when it fails for example due to insufficient disk space which leads to a crash when memcpy tries to access the map.

CreateFileMappingA returns a NULL handle when it fails for example due to insufficient disk space which leads to a crash when memcpy tries to access the map.
@SergioRAgostinho SergioRAgostinho added the needs: code review Specify why not closed/merged yet label Dec 12, 2017
@@ -197,6 +197,11 @@ pcl::PCDWriter::writeBinary (const std::string &file_name,
// Prepare the map
#if _WIN32
HANDLE fm = CreateFileMappingA (h_native_file, NULL, PAGE_READWRITE, 0, (DWORD) (data_idx + data_size), NULL);
if (fm == NULL)
{
throw pcl::IOException("[pcl::PCDWriter::writeBinary] Error during write ()!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify the error message to indicate that there was an error during memory map creation.

@SergioRAgostinho
Copy link
Member

👍 Thanks.

@SergioRAgostinho SergioRAgostinho added needs: author reply Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Dec 13, 2017
@SergioRAgostinho SergioRAgostinho removed the needs: author reply Specify why not closed/merged yet label Dec 13, 2017
@SergioRAgostinho SergioRAgostinho merged commit 98fc222 into PointCloudLibrary:master Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants