You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I add a line like log = log.With().Logger() before calling log.UpdateContext, it's OK.
This was introduced by #226, specifically here. The dst byte array is no longer being length-checked before attempting to access index len(dst)-1 (-1 when the array is empty - i.e. when it hasn't been initailized yet).
Note that I only ran into this in a unit test, and is easily worked around by calling log.With(), but it's reasonable to assume this will affect other code as well.
This workaround only works because enc.AppendBeginMarkeris now called by With, and it tolerates a zero-length array and produces an array of length 1.
I'm seeing a new panic with v0.19.0 that I didn't experience with v0.18.0:
This code can reproduce it:
If I add a line like
log = log.With().Logger()
before callinglog.UpdateContext
, it's OK.This was introduced by #226, specifically here. The
dst
byte array is no longer being length-checked before attempting to access indexlen(dst)-1
(-1
when the array is empty - i.e. when it hasn't been initailized yet).Note that I only ran into this in a unit test, and is easily worked around by calling
log.With()
, but it's reasonable to assume this will affect other code as well.This workaround only works because
enc.AppendBeginMarker
is now called byWith
, and it tolerates a zero-length array and produces an array of length1
./cc @ffenix113 @rs
The text was updated successfully, but these errors were encountered: