Mercurial > hg > orthanc
comparison OrthancFramework/Resources/Patches/dcmtk-3.6.5.patch @ 4289:dd17d37ad950
backporting a patch for DCMTK 3.6.5 to resolve a bad memory access in C-GET SCP
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Nov 2020 18:34:44 +0100 |
parents | d25f4c0fa160 |
children |
comparison
equal
deleted
inserted
replaced
4288:5b254bd435d3 | 4289:dd17d37ad950 |
---|---|
1 diff -urEb dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake | 1 diff -urEb dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake |
2 --- dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake 2020-06-08 22:19:03.265799573 +0200 | 2 --- dcmtk-3.6.5.orig/CMake/GenerateDCMTKConfigure.cmake 2020-11-04 18:27:08.984662119 +0100 |
3 +++ dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake 2020-06-08 22:21:22.670025141 +0200 | 3 +++ dcmtk-3.6.5/CMake/GenerateDCMTKConfigure.cmake 2020-11-04 18:27:48.232609773 +0100 |
4 @@ -169,6 +169,8 @@ | 4 @@ -169,6 +169,8 @@ |
5 endif() | 5 endif() |
6 | 6 |
7 # Check the sizes of various types | 7 # Check the sizes of various types |
8 +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") | 8 +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") |
17 +endif() | 17 +endif() |
18 | 18 |
19 # Check for include files, libraries, and functions | 19 # Check for include files, libraries, and functions |
20 include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake") | 20 include("${DCMTK_CMAKE_INCLUDE}CMake/dcmtkTryCompile.cmake") |
21 diff -urEb dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h | 21 diff -urEb dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h |
22 --- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-06-08 22:19:03.229799498 +0200 | 22 --- dcmtk-3.6.5.orig/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-11-04 18:27:08.972662135 +0100 |
23 +++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-06-08 22:19:35.317862998 +0200 | 23 +++ dcmtk-3.6.5/dcmdata/include/dcmtk/dcmdata/dcdict.h 2020-11-04 18:27:48.232609773 +0100 |
24 @@ -152,6 +152,12 @@ | 24 @@ -152,6 +152,12 @@ |
25 /// returns an iterator to the end of the repeating tag dictionary | 25 /// returns an iterator to the end of the repeating tag dictionary |
26 DcmDictEntryListIterator repeatingEnd() { return repDict.end(); } | 26 DcmDictEntryListIterator repeatingEnd() { return repDict.end(); } |
27 | 27 |
28 + // Function by the Orthanc project to load a dictionary from a | 28 + // Function by the Orthanc project to load a dictionary from a |
33 + | 33 + |
34 private: | 34 private: |
35 | 35 |
36 /** private undefined assignment operator | 36 /** private undefined assignment operator |
37 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc | 37 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc |
38 --- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc 2020-06-08 22:19:03.245799531 +0200 | 38 --- dcmtk-3.6.5.orig/dcmdata/libsrc/dcdict.cc 2020-11-04 18:27:08.976662131 +0100 |
39 +++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc 2020-06-08 22:19:35.317862998 +0200 | 39 +++ dcmtk-3.6.5/dcmdata/libsrc/dcdict.cc 2020-11-04 18:27:48.232609773 +0100 |
40 @@ -900,3 +900,6 @@ | 40 @@ -900,3 +900,6 @@ |
41 wrlock().clear(); | 41 wrlock().clear(); |
42 wrunlock(); | 42 wrunlock(); |
43 } | 43 } |
44 + | 44 + |
45 + | 45 + |
46 +#include "dcdict_orthanc.cc" | 46 +#include "dcdict_orthanc.cc" |
47 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc | 47 diff -urEb dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc |
48 --- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc 2020-06-08 22:19:03.245799531 +0200 | 48 --- dcmtk-3.6.5.orig/dcmdata/libsrc/dcpxitem.cc 2020-11-04 18:27:08.976662131 +0100 |
49 +++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc 2020-06-08 22:19:35.317862998 +0200 | 49 +++ dcmtk-3.6.5/dcmdata/libsrc/dcpxitem.cc 2020-11-04 18:27:48.232609773 +0100 |
50 @@ -36,6 +36,9 @@ | 50 @@ -36,6 +36,9 @@ |
51 #include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */ | 51 #include "dcmtk/dcmdata/dcostrma.h" /* for class DcmOutputStream */ |
52 #include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */ | 52 #include "dcmtk/dcmdata/dcwcache.h" /* for class DcmWriteCache */ |
53 | 53 |
54 +#undef max | 54 +#undef max |
55 +#include "dcmtk/ofstd/oflimits.h" | 55 +#include "dcmtk/ofstd/oflimits.h" |
56 + | 56 + |
57 | 57 |
58 // ******************************** | 58 // ******************************** |
59 | 59 |
60 diff -urEb dcmtk-3.6.5.orig/dcmnet/libsrc/dulparse.cc dcmtk-3.6.5/dcmnet/libsrc/dulparse.cc | |
61 --- dcmtk-3.6.5.orig/dcmnet/libsrc/dulparse.cc 2020-11-04 18:27:09.004662093 +0100 | |
62 +++ dcmtk-3.6.5/dcmnet/libsrc/dulparse.cc 2020-11-04 18:29:41.832458294 +0100 | |
63 @@ -736,7 +736,14 @@ | |
64 << " is larger than maximum allowed UID length " << DICOM_UI_LENGTH << " (will use 64 bytes max)"); | |
65 UIDLength = DICOM_UI_LENGTH; | |
66 } | |
67 - OFStandard::strlcpy(role->SOPClassUID, (char*)buf, UIDLength+1 /* +1 for 0-byte */); | |
68 + | |
69 + // Patch from: https://github.com/DCMTK/dcmtk/commit/10428a74e74c003b3ff31c992f658d528b626fab | |
70 + // The UID in the source buffer is not necessarily null terminated. Copy with memcpy | |
71 + // and add a zero byte. We have already checked that there is enough data available | |
72 + // in the source source buffer and enough space in the target buffer. | |
73 + (void) memcpy(role->SOPClassUID, buf, UIDLength); | |
74 + role->SOPClassUID[UIDLength] = '\0'; | |
75 + | |
76 buf += UIDLength; | |
77 role->SCURole = *buf++; | |
78 role->SCPRole = *buf++; | |
60 diff -urEb dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h | 79 diff -urEb dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h |
61 --- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-06-08 22:19:03.261799565 +0200 | 80 --- dcmtk-3.6.5.orig/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-11-04 18:27:08.980662125 +0100 |
62 +++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-06-08 22:19:35.317862998 +0200 | 81 +++ dcmtk-3.6.5/oflog/include/dcmtk/oflog/thread/syncpub.h 2020-11-04 18:27:48.232609773 +0100 |
63 @@ -63,7 +63,7 @@ | 82 @@ -63,7 +63,7 @@ |
64 | 83 |
65 DCMTK_LOG4CPLUS_INLINE_EXPORT | 84 DCMTK_LOG4CPLUS_INLINE_EXPORT |
66 Mutex::Mutex (Mutex::Type t) | 85 Mutex::Mutex (Mutex::Type t) |
67 - : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0) | 86 - : mtx (DCMTK_LOG4CPLUS_THREADED (new impl::Mutex (t)) + 0) |
104 + : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex)) | 123 + : sm (DCMTK_LOG4CPLUS_THREADED (new impl::SharedMutex)) |
105 { } | 124 { } |
106 | 125 |
107 | 126 |
108 diff -urEb dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc dcmtk-3.6.5/oflog/libsrc/oflog.cc | 127 diff -urEb dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc dcmtk-3.6.5/oflog/libsrc/oflog.cc |
109 --- dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc 2020-06-08 22:19:03.261799565 +0200 | 128 --- dcmtk-3.6.5.orig/oflog/libsrc/oflog.cc 2020-11-04 18:27:08.984662119 +0100 |
110 +++ dcmtk-3.6.5/oflog/libsrc/oflog.cc 2020-06-08 22:19:35.317862998 +0200 | 129 +++ dcmtk-3.6.5/oflog/libsrc/oflog.cc 2020-11-04 18:27:48.232609773 +0100 |
111 @@ -19,6 +19,10 @@ | 130 @@ -19,6 +19,10 @@ |
112 * | 131 * |
113 */ | 132 */ |
114 | 133 |
115 +#if defined(_WIN32) | 134 +#if defined(_WIN32) |
118 + | 137 + |
119 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ | 138 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ |
120 #include "dcmtk/oflog/oflog.h" | 139 #include "dcmtk/oflog/oflog.h" |
121 | 140 |
122 diff -urEb dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h | 141 diff -urEb dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h |
123 --- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h 2020-06-08 22:19:03.293799632 +0200 | 142 --- dcmtk-3.6.5.orig/ofstd/include/dcmtk/ofstd/offile.h 2020-11-04 18:27:09.008662088 +0100 |
124 +++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h 2020-06-08 22:19:35.317862998 +0200 | 143 +++ dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/offile.h 2020-11-04 18:27:48.232609773 +0100 |
125 @@ -575,7 +575,7 @@ | 144 @@ -575,7 +575,7 @@ |
126 */ | 145 */ |
127 void setlinebuf() | 146 void setlinebuf() |
128 { | 147 { |
129 -#if defined(_WIN32) || defined(__hpux) | 148 -#if defined(_WIN32) || defined(__hpux) |