The patch has been submitted upstream, and will likely be incorporated after 
their review processes.

The discussion is here: https://github.com/Ravenbrook/mps/issues/276

Thank you again for reporting the issue!

On 2023-12-16 19:55, Filip Strömbäck wrote:
Dear наб,

Thank you for your bug report.

I have notified the upstream developers of MPS about this, to see if the patch 
can be applied upstream as well. Regardless, I will include the fix when I 
upload the next version of the package (likely in January).

Best,
Filip

On 2023-12-16 09:50, наб wrote:
Source: storm-lang
Version: 0.6.19-1
Severity: minor
Tags: patch

Dear Maintainer,

As found by DCS query [^._]sizeof[ (]'.{1,2}' filetype:c

The website is an information black hole, didn't find a mail address
there, so submitting here.

Patch based on the git, so paths based on the mps submodule already.

Best,
наб

-- System Information:
Debian Release: 12.2
   APT prefers stable-updates
   APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-9-amd64 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_FIRMWARE_WORKAROUND, 
TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

 From f8c2ecf90eeae779c7a03c9313717559eb3b4159 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczlew...@nabijaczleweli.xyz>
Date: Sat, 16 Dec 2023 01:45:44 +0100
Subject: [PATCH] sizeof('c')=4, not 1: fix overallocations
X-Mutt-PGP: OS

As found by DCS: [^._]sizeof[ (]'.{1,2}' filetype:c

Ref: 
https://paste.sr.ht/~nabijaczleweli/6ee9ccf301a2651afb693bff46e3671d3f7cdd89
Ref: https://101010.pl/@nabijaczleweli/111587138076843793
---
  code/event.h    | 2 +-
  code/eventcom.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/code/event.h b/code/event.h
index 954b315b..358064d9 100644
--- a/code/event.h
+++ b/code/event.h
@@ -84,7 +84,7 @@ extern Word EventKindControl;
      size_t _string_len = (length); \
      size_t size; \
      AVER(_string_len <= EventStringLengthMAX); \
-    size = offsetof(Event##name##Struct, f1) + _string_len + sizeof('\0'); \
+    size = offsetof(Event##name##Struct, f1) + _string_len + 1 /* NUL */; \
      EVENT_BEGIN(name, size) \
        _event->f0 = (p0); \
        (void)mps_lib_memcpy(_event->f1, (string), _string_len); \
diff --git a/code/eventcom.h b/code/eventcom.h
index 75886be3..243570da 100644
--- a/code/eventcom.h
+++ b/code/eventcom.h
@@ -91,7 +91,7 @@ typedef void *EventFP;                  /* pointer to C 
object */
  typedef Addr EventFA;                   /* address on the heap */
  typedef Word EventFW;                   /* word */
  typedef unsigned EventFU;               /* unsigned integer */
-typedef char EventFS[EventStringLengthMAX + sizeof('\0')]; /* string */
+typedef char EventFS[EventStringLengthMAX + 1 /* NUL */]; /* string */
  typedef double EventFD;                 /* double */
  typedef unsigned char EventFB;          /* Boolean */


Attachment: OpenPGP_0x16C56181D19233AF.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to