3 ms·
Back in college I made a similar mistake. I was taking a class in software security and had a homework assignment to demonstrate a buffer overflow. For extra c
by gizmo686 5y ago
Back in college I made a similar mistake.
I was taking a class in software security and had a homework assignment to demonstrate a buffer overflow. For extra credit, we could have our exploit play music without invoking exec. My approach to this was fairly straightforward. Using ffmpeg I converted the audio to raw 16bit little-endian PCM. Then I appended this data to the end of my exploit. When my exploit runs, it sets some ioctls on /dev/audio then starts copying the data from the end of the file to /dev/audio causing sound to play.
As you might have guessed by reading the article, I had an off-by-one error, causing the music data to be misalligned and loud static to play. Fortunately, my system volume was not particularly high, and I was happy to even get sound to play. I never figured out where I made an off-by-one error, since I had just assumed that the static was caused by an alignment issue that could be "fixed" by adding a 0 byte to the start of the audio data.