The rest of your code? IANAL but I don’t think it’s viral like the GPL.
The way I understand it, if you fix a bug in an SO code snippet, then in theory you own that bug fix back to the crowd.
EDIT: The more I read about this the more cringeworthy it becomes. CC BY-SA is not designed for source code. The language in the actual license is extremely imprecise for trying to reason about using modular bits of CC licensed code in a complex system.
“Adapted Material” is defined simply as;
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material
... and ...
in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor.
Is my 100,000 LOC application “derived from” or “based upon” a function which converts a hex string to a byte[]? That’s a question that can only be decided in a courtroom, and to my knowledge CC BY-SA has never been litigated in the context of source code.
My inclination is that the terms “derived from” and “based upon” must necessarily carry a stronger meaning than, for example, “incorporates” or other similar terms which would not imply a central shared function or feature.