antirez / sds

Simple Dynamic Strings library for C
BSD 2-Clause "Simplified" License
4.89k stars 473 forks source link

sds and interrupts #110

Open k1mgy opened 5 years ago

k1mgy commented 5 years ago

I've been investigating a nasty firmware crash that, until now, was a huge mystery.

While debugging some new code that uses SDS, I single stepped into sdscmp(). There, I noticed that one of the two variables was totally different than the ones being compared. And, when sdscmp() returned, the stack pointer was apparently ruined, as I was taken back to a process that a 1-second interrupt handler uses for sdscmp().

I suppose it's possible this is an artifact of my debugger (Atmel Studio 7).

However, if not, could there be a case where the sdscmp() function (or for that matter any sds function) cannot be called by two different processes, one of which is an interrupt service routine?