2026-04-23
GitHub | bertrandom/chrome-cookies-secure
On decrypting cookies set by one particular site (Goodreads.com), I got the following error: > RangeError: out of range index > at RangeError (native) > at decrypt (node_modules/chrome-cookies-secure/index.js:59:8) > at Statement.db.each.host (node_modules/chrome-cookies-secure/index.js:268:21) The offending line 59 is `final.copy(decoded, decoded.length - 1);`. Changing it to `final.copy(decoded, decoded.length ? decoded.length - 1 : 0);` (no longer assuming that the target buffer contains data) fixed the issue for me, though I don't know if that's the best solution.