Focus on InvalidPartitionName's string memory bug
Hi I closed inadvertently my previous PR https://github.com/microsoft/ifc/pull/30, probably because I force-pushed my related branch. So, I am creating another PR to focus specifically on the memory/life-time issue when catching InvalidPartitionName in translate_exception and accessing the member name. I hope this can help @cdacamar reproduce/analyze the issue. (I have put my sample file and added some temporary cmake-stuff to test it easily)
Thank you for the focused test case. I do indeed see that there's an odd lifetime issue here. I believe what I want to suggest is that instead of using std::string we use a statically sized buffer to avoid extra memory allocation for the exception object. This can avoid issues where more code is executed than is strictly necessary to throw the exception.
I suspect a smallish buffer (say 64 bytes) is sufficient since our longest valid partition offset is currently 39 bytes. If the name is longer than 64 we can truncate it.