Bug 99 - PamWriter test segfaults on alpine linux with gcc 6.4.0
Summary: PamWriter test segfaults on alpine linux with gcc 6.4.0
Status: RESOLVED FIXED
Alias: None
Product: Orthanc
Classification: Unclassified
Component: Orthanc Core (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Assignee: Sébastien Jodogne
URL:
Depends on:
Blocks:
 
Reported: 2020-06-29 15:14 CEST by Sébastien Jodogne
Modified: 2020-06-29 15:22 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sébastien Jodogne 2020-06-29 15:14:05 CEST
[BitBucket user: Miklós Espák]
[BitBucket date: 2018-08-08.21:57:14]

I built Orthanc 1.4.1 in an alpine:3.8 docker container.

The PamWriter.EndToEnd test crashes (segfault, core dumped).

The crash is at the first iteration of this loop:

https://hg.orthanc-server.com/orthanc/file/218854b02a71c1ba79b446bf4273179b0098ae48/Core/Images/PamReader.cpp#L214

Strangely, if I print out the loop variables (h and w) before the assignment in the inner loop, the crash does not happen and the test passes.

The issue may be related to that alpine uses musl libc, not glibc. The byte order is little endian.

I found that if I redefine the `__orthanc_bswap16` function just like here:

https://hg.orthanc-server.com/orthanc/file/218854b02a71c1ba79b446bf4273179b0098ae48/Core/Endianness.h#L146

then the crash goes away and the test passes.
Comment 1 Sébastien Jodogne 2020-06-29 15:22:13 CEST
[BitBucket user: Sébastien Jodogne]
[BitBucket date: 2018-09-04.13:58:33]

Fix issue #99 (PamWriter test segfaults on alpine linux with gcc 6.4.0)

→ https://hg.orthanc-server.com/orthanc/changeset/6356e2ceb493