sh
is for shell.Bad name.
For a little bit I thought this library might be a subtle joke, seeing the
at the start. That combined with the
compress()
anddecompress()
not taking any arguments and not having a return value, I thought we were being played. Not to mention the library appears to be plain C rather than C++… surely the author should know the difference?Then I saw how the interface actually works:
// interface for the library user, implement these in your program: unsigned int SPR_in(); // Return next byte from input or value > 255 on EOF. void SPR_out(unsigned char); // Output byte.
This seems extremely poorly thought out. Calling into global functions for input and output means that your library will be a pain to use in any program that has to (de)compress anything more than a single input.
Does it compress from the middle out?
This guy develops on windows
You have stack buffer out of bounds write. On line
52
you declareh
an array of70
unsigned int
s. On line57
you store reference to such array. Later, on line35
you write out of bounds, one element past end of the array. The_SPR_history[i]
writes to_SPR_history[70]
. Created an issue: https://github.com/X64X2/sh/issues/1