NetBSD Problem Report #58719
From www@netbsd.org Sat Oct 5 19:50:28 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 4A64F1A923D
for <gnats-bugs@gnats.NetBSD.org>; Sat, 5 Oct 2024 19:50:28 +0000 (UTC)
Message-Id: <20241005195026.9F6591A923E@mollari.NetBSD.org>
Date: Sat, 5 Oct 2024 19:50:26 +0000 (UTC)
From: cryintothebluesky@gmail.com
Reply-To: cryintothebluesky@gmail.com
To: gnats-bugs@NetBSD.org
Subject: wm/cde crashes in dthelpview during startup on sparc64
X-Send-Pr-Version: www-1.0
>Number: 58719
>Category: pkg
>Synopsis: wm/cde crashes in dthelpview during startup on sparc64
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Oct 05 19:55:00 +0000 2024
>Originator: Sad Clouds
>Release: pkg-2024Q2
>Organization:
>Environment:
>Description:
During first run of CDE, program dthelpview is started automatically but then crashes with SIGBUS due to alignment issues on sparc64
>How-To-Repeat:
Run dthelpview X11 client with the following parameters:
dthelpview -helpVolume Intromgr
>Fix:
--- cde-2.5.2/lib/DtHelp/il/iltiff.c.orig 2023-11-18 22:38:09.000000000 +0000
+++ cde-2.5.2/lib/DtHelp/il/iltiff.c 2024-10-05 20:29:11.835179256 +0100
@@ -42,6 +42,7 @@
*/
#include <stdlib.h>
+#include <stdint.h>
#include "iltiffint.h"
#include "ilerrors.h"
@@ -150,6 +151,18 @@
int tagNumber, nFileTags, nItems, nTags, tagType, i;
ilBool bigEndian;
+/*
+* Attempt to determine ILP32 or LP64 data model in a portable manner
+* Assume size of pointer (hence its alignment) corresponds to UINTPTR_MAX value
+*/
+#if UINTPTR_MAX <= UINT32_MAX /* 32-bit pointers */
+ const size_t align_mask = 3; /* Alignment on 4-byte boundary */
+#elif UINTPTR_MAX <= UINT64_MAX /* 64-bit pointers */
+ const size_t align_mask = 7; /* Alignment on 8-byte boundary */
+#else /* UINTPTR_MAX > UINT64_MAX */
+ #error "Cannot determine correct alignment for pointers"
+#endif
+
pFileImage = (ilFileImagePtr)fileImage;
if (mustBeZero != 0) {
pFileImage->context->error = IL_ERROR_PAR_NOT_ZERO;
@@ -217,7 +230,7 @@
}
if (tagFound) {
mallocSize += (sizeof (ilFileTag) +
- (pFileTag->length * _ilTagTypeItemSizes [pFileTag->type] + 3)) & ~3;
+ (pFileTag->length * _ilTagTypeItemSizes [pFileTag->type] + align_mask)) & ~align_mask;
*ppTag++ = (ilFileTag *)pFileTag;
}
else *ppTag++ = (ilFileTag *)NULL;
@@ -272,7 +285,7 @@
else {
pTag->pItems = pTagData; /* data follows the tag */
pTag = (ilFileTag *)(pTagData + /* next spot = past data, long-aligned */
- ((nItems * _ilTagTypeItemSizes [tagType] + 3) & ~3));
+ ((nItems * _ilTagTypeItemSizes [tagType] + align_mask) & ~align_mask));
/* Byte flip the tag data to the spot pointed to by "pTagData",
i.e. right after the 12 bytes for the tag. In TIFF, the data
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.