Printf bit me
< 1 Minute Read.
Working on an Unreal Engine 4 project, I had a strage issue with their FString::Printf(format, args...)
function (which is basically just calling _vsntprintf
).
The final issue was that I was trying to build a SQL query along the lines of INSERT INTO Table(a, b, c) VALUES(%d, %d, %d)
,
into which I would then format in the values.
The value for b
was a 64bit integer value, though, which on Android caused the parameter to leak over into the next,
because I was not formatting it as a long (“%lld”), but as an integer (“%d”).
I learnt the painful way and am happy that it “only” cost me two hours.
Written in 5 minutes, edited in 5 minutes.