tinyply icon indicating copy to clipboard operation
tinyply copied to clipboard

Reading file causes heap corruption

Open HiImJulien opened this issue 4 years ago • 1 comments

Hey there! Lately I am fighting with heap corruptions, that are caused by the custom deleter used by the class Buffer. This bug probably related to #3 and #46.

The file I tried to parse, uses tri- and quadfaces; while latter were unwanted it causes your parser to exhibit following behavior:

Reading the lists with a size hint

const auto index_buffer = ply.request_properties_from_element("face", {"vertex_indices"}, 3);

causes a Heap corruption, when cleaning up the buffer.

Omitting the list_size_hint yields the exception, that "Variable length lists are not supported." as probably expected.

HiImJulien avatar Oct 22 '20 14:10 HiImJulien

#3 is accurate. #46 I resolved with the issue's author on email somewhat (NaN's in ascii are not supported but I don't document that anywhere). I'm not sure I'll address this particular issue as a hotfix to version 2.3. Version 2.4 is on a branch and supports variable length lists correctly.

The specific bug you're running into with the heap corruption is that I never verify that the list size matches the hint in the inner loop and then throw a similar exception. I might have had it at one point and removed for better performance.

ddiakopoulos avatar Oct 28 '20 04:10 ddiakopoulos