1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

(bindat--unpack-item): Sanitize vector length

Copyright-paperwork-exempt: yes

* lisp/emacs-lisp/bindat.el (bindat--unpack-item): Sanitize vector length
This commit is contained in:
Petteri Hintsanen 2024-03-10 23:30:11 -04:00 committed by Stefan Monnier
parent 887789eecc
commit ed43ad5b56

View file

@ -204,6 +204,9 @@
('str (bindat--unpack-str len)) ('str (bindat--unpack-str len))
('strz (bindat--unpack-strz len)) ('strz (bindat--unpack-strz len))
('vec ('vec
(when (> len (length bindat-raw))
(error "Vector length %d is greater than raw data length %d."
len (length bindat-raw)))
(let ((v (make-vector len 0)) (vlen 1)) (let ((v (make-vector len 0)) (vlen 1))
(if (consp vectype) (if (consp vectype)
(setq vlen (nth 1 vectype) (setq vlen (nth 1 vectype)