all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.