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

Fail to decompress package part in the case of large mesh objects #392

Open
Dober-Mann opened this issue Sep 12, 2024 · 0 comments
Open

Comments

@Dober-Mann
Copy link

lib3mf version: 2.3.0.0-2.3.2.0
Operating systems: Linux Mint 22 / Windows 10 (under MSYS2 ucrt64 gcc)

The code to obtain all the 3mf container examples attached to the issue is based on (links are relative to the repository):

  1. /lib3mf/SDK/CPackExamples/Cpp/Source/SecureCube.cpp
  2. /lib3mf/Tests/CPP_Bindings/Source/{EncryptionMethods.cpp,SecureContent.cpp} + included UnitTest_EncryptionUtils.h

Let's consider creating a separate part PackagePart /3D/3dobjects.model inside OPC, including MeshObjects and ComponentsObjects, with the purpose of its subsequent protection by encryption after preliminary compression. At first, we will use the simplest copying data transformation as encryption, as in example (1), but with compression enabled ResourceData:

auto rd = keyStore->AddResourceData(rdGroup.get(), objectsPart.get(), Lib3MF::eEncryptionAlgorithm::AES256_GCM, Lib3MF::eCompression::Deflate, aad);

Issue 1

If you use simple cube as mesh object, then you can successfully save and restore from the 3mf OPC (example cube_comp_noencrypt.3mf). If you replace the cube with more real objects (cube + fine sphere) with many vertices (example cube_sphere_comp_noencrypt.3mf), then when restoring the scene from the resulting 3mf file, an error occurs:

Lib3MF reading file encountered error #5: Error: GENERICEXCEPTION: Failed to decompress part

A similar error occurs when using real encryption (using the keys specified in the repository examples /lib3mf/Tests/TestFiles/SecureContent/sample.pem) of the section data (examples cube_comp_encrypt.3mf and cube_sphere_comp_encrypt.3mf, respectively).

Issue 2

If you use part encryption (in reality and in the form of copying transformation), but disable its preliminary compression:

auto rd = keyStore->AddResourceData(rdGroup.get(), objectsPart.get(), Lib3MF::eEncryptionAlgorithm::AES256_GCM, Lib3MF::eCompression::NoCompression, aad);

then compression of the entire OPC 3mf is unpredictablly disabled, but the scene is restored correctly (the size of the example cube_sphere_nocomp_encrypt.3mf compared to cube_sphere_nocomp_noencrypt.3mf).

Discussed above 3mf_examples.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant