when input buffer is less than 8 bytes these will corrupt memory. I think these start writing at tmp[-4]. If input buffer size is 0, then lz4 will be called with size_t(0-4).
Another issue, vsdec32 supposedly returns end of consumed input buffer. It returns sometimes 1 byte less than expected.