From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Petteri Hintsanen Newsgroups: gmane.emacs.devel Subject: Re: Bindat can exhaust memory when unpacking to vector Date: Sun, 12 Nov 2023 21:11:44 +0200 Message-ID: References: <87pm16fnzv.fsf@iki.fi> <83zg09oa1v.fsf@gnu.org> <87a5s9m8ri.fsf@iki.fi> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31670"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 12 20:18:58 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r2Fz0-00081Z-4Z for ged-emacs-devel@m.gmane-mx.org; Sun, 12 Nov 2023 20:18:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r2Fy4-0003pO-Ls; Sun, 12 Nov 2023 14:18:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2Fs9-0002Yj-Hi for emacs-devel@gnu.org; Sun, 12 Nov 2023 14:11:53 -0500 Original-Received: from mail.kapsi.fi ([2001:67c:1be8::25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r2Fs7-0000jw-Er; Sun, 12 Nov 2023 14:11:53 -0500 Original-Received: from kapsi.fi ([2001:67c:1be8::11] helo=lakka.kapsi.fi) by mail.kapsi.fi with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r2Fs1-00Ahjg-0C; Sun, 12 Nov 2023 21:11:45 +0200 Original-Received: from phintsan by lakka.kapsi.fi with local (Exim 4.94.2) (envelope-from ) id 1r2Fs0-005ozi-Lq; Sun, 12 Nov 2023 21:11:44 +0200 In-Reply-To: (tomas@tuxteam.de's message of "Tue, 24 Oct 2023 06:34:40 +0200") X-Rspam-Score: -3.1 (---) X-Rspam-Report: Action: no action Symbol: FROM_HAS_DN(0.00) Symbol: FROM_EQ_ENVFROM(0.00) Symbol: RCVD_COUNT_TWO(0.00) Symbol: BAYES_HAM(-3.00) Symbol: TO_MATCH_ENVRCPT_ALL(0.00) Symbol: RCVD_TLS_LAST(0.00) Symbol: DMARC_NA(0.00) Symbol: MIME_GOOD(-0.10) Symbol: NEURAL_HAM(0.00) Symbol: R_DKIM_NA(0.00) Symbol: MID_RHS_MATCH_FROM(0.00) Symbol: R_SPF_NEUTRAL(0.00) Symbol: ARC_NA(0.00) Symbol: ASN(0.00) Symbol: MIME_TRACE(0.00) Symbol: TO_DN_SOME(0.00) Symbol: RCPT_COUNT_THREE(0.00) Message-ID: x2mwmumzszz.fsf@iki.fi X-SA-Exim-Connect-IP: 2001:67c:1be8::11 X-SA-Exim-Mail-From: petterih@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Received-SPF: neutral client-ip=2001:67c:1be8::25; envelope-from=petterih@iki.fi; helo=mail.kapsi.fi X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 12 Nov 2023 14:17:58 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312658 Archived-At: Stefan Monnier writes: > Kind of an embarrassing blind spot. BinDat should instead encourage the > addition of sanity checks within the parsing code (including maybe add > specific support for it). This was also something I had in mind, along the lines of what Tomas wrote below: writes: > OTOH, a maximum length of something might be thought as a (n optional) > part of a type description. Types are predicates. > > As could be a set of bounds for a numerical type. Perhaps there's an > extension opportunity for bindat. So yes, I also agree that this could be an extension opportunity, but I wouldn't push it further until we have concrete use cases. It is usually futile to try to generalize from zero examples. (Well, I do have one example, but still.) For the time being using inline checks within the specification suffices for me. Thanks, Petteri