Bug 99

Summary: PamWriter test segfaults on alpine linux with gcc 6.4.0
Product: Orthanc Reporter: Sébastien Jodogne <s.jodogne>
Component: Orthanc CoreAssignee: Sébastien Jodogne <s.jodogne>
Status: RESOLVED FIXED    
Severity: normal    
Priority: ---    
Version: unspecified   
Hardware: All   
OS: All   

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