GNU bug report logs - #55938
[PATCH] bindat (strz): Error on null byte if packing variable-length string

Previous Next

Package: emacs;

Reported by: Richard Hansen <rhansen <at> rhansen.org>

Date: Mon, 13 Jun 2022 05:49:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55938 in the body.
You can then email your comments to 55938 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#55938; Package emacs. (Mon, 13 Jun 2022 05:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Hansen <rhansen <at> rhansen.org>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Mon, 13 Jun 2022 05:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Hansen <rhansen <at> rhansen.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] bindat (strz): Error on null byte if packing variable-length
 string
Date: Mon, 13 Jun 2022 01:48:11 -0400
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: monnier <at> iro.umontreal.ca

Attached patch:

* lisp/emacs-lisp/bindat.el (strz): Signal an error if a null byte is
encountered while packing a string to a variable-length strz field.
* test/lisp/emacs-lisp/bindat-tests.el (strz): Add tests.
[0001-bindat-strz-Error-on-null-byte-if-packing-variable-l.patch (text/x-patch, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55938; Package emacs. (Mon, 13 Jun 2022 12:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 55938 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Richard Hansen <rhansen <at> rhansen.org>
Cc: 55938 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#55938: [PATCH] bindat (strz): Error on null byte if packing
 variable-length string
Date: Mon, 13 Jun 2022 14:32:27 +0200
Richard Hansen <rhansen <at> rhansen.org> writes:

> * lisp/emacs-lisp/bindat.el (strz): Signal an error if a null byte is
> encountered while packing a string to a variable-length strz field.
> * test/lisp/emacs-lisp/bindat-tests.el (strz): Add tests.

Thanks; pushed to Emacs 29.  (But I changed the `if' to a `when'.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 55938 <at> debbugs.gnu.org and Richard Hansen <rhansen <at> rhansen.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 Jun 2022 12:33:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55938; Package emacs. (Mon, 13 Jun 2022 13:13:02 GMT) Full text and rfc822 format available.

Message #13 received at 55938 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Richard Hansen <rhansen <at> rhansen.org>
Cc: 55938 <at> debbugs.gnu.org
Subject: Re: bug#55938: [PATCH] bindat (strz): Error on null byte if packing
 variable-length string
Date: Mon, 13 Jun 2022 09:12:20 -0400
>    (let* ((v (string-to-unibyte v))
>           (len (length v)))
>      (dotimes (i len)
> +      (if (= (aref v i) 0)
> +          ;; Alternatively we could pretend that this was the end of
> +          ;; the string and stop packing, but then bindat-length would
> +          ;; need to scan the input string looking for a null byte.
> +          (error "Null byte encountered in input strz string"))

I suspect a `string-match` looking for NUL would be faster.


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 12 Jul 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.