* Re: [nongnu] elpa/base32 66741b0aeb 1/5: base32-decode: Handle payloads shorter than allowed padding lengths
[not found] ` <20240227180352.0423AC12D93@vcs2.savannah.gnu.org>
@ 2024-02-27 18:29 ` Stefan Monnier
0 siblings, 0 replies; only message in thread
From: Stefan Monnier @ 2024-02-27 18:29 UTC (permalink / raw)
To: Vivek Das Mohapatra; +Cc: emacs-devel
> ((eq 0 input-shortfall) ;; already padded
> (setq output-shorten
> - (cond ((equal (substring input -6) "======") -4)
> - ((equal (substring input -4) "====") -3)
> - ((equal (substring input -3) "===") -2)
> - ((equal (substring input -1) "=") -1)
> + (cond ((equal (ignore-errors (substring input -6)) "======") -4)
> + ((equal (ignore-errors (substring input -4)) "====") -3)
> + ((equal (ignore-errors (substring input -3)) "===") -2)
> + ((equal (ignore-errors (substring input -1)) "=") -1)
> (t 0))))
> (t (error "Invalid base32 payload length: %d" input-byte-count)))
You might want to use `string-suffix-p`. 🙂
Stefan
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-27 18:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <170905703121.16813.9921171410947077478@vcs2.savannah.gnu.org>
[not found] ` <20240227180352.0423AC12D93@vcs2.savannah.gnu.org>
2024-02-27 18:29 ` [nongnu] elpa/base32 66741b0aeb 1/5: base32-decode: Handle payloads shorter than allowed padding lengths Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).