WIP: Fix segmentation fault with neatopack.c
Fixes two bugs that caused #1800 (closed) and adds a workaround for the third. It's WIP because:
- I really would like to get feedback whether you think that the first two bugfixes are the right way to fix those problems.
- The third bug is worked around since I cannot possibly understand how it's supposed to work and I would like to have suggestions on how it should be fixed properly.
Se my commit messages for (a few) details. I would especially appreciate if also @emden @truenorth or @ellson could give me your thoughts on this since I haven't even understood what the testcase does, not to mention what the overall functionality of the software is. I feel like I am a laparoscopic surgeon who doesn't know if he is operating on a human or on a squirrel. Or on a sea cucumber for that matter.