]>
Commit | Line | Data |
---|---|---|
53ed7900 | 1 | Avoid (eventually fixing some bugs): |
b9bc5ba2 JB |
2 | "error: array subscript is below array bounds [-Werror=array-bounds]" |
3 | "directive writing ... bytes into a region of size ... [-Werror=format-overflow=]" | |
4 | "error: ... may be used uninitialized in this function [-Werror=maybe-uninitialized]" | |
53ed7900 JB |
5 | "error: ... specified bound ... equals destination size [-Werror=stringop-truncation]" |
6 | "error: ... may be used uninitialized in this function [-Werror=maybe-uninitialized]" | |
7 | "error: bitwise comparison always evaluates to true [-Werror=tautological-compare]" | |
b9bc5ba2 JB |
8 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/Formats/XnFormatsMirror.cpp.orig 2013-11-12 15:12:23.000000000 +0100 |
9 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Formats/XnFormatsMirror.cpp 2020-03-15 21:05:31.154704162 +0100 | |
10 | @@ -43,7 +43,6 @@ | |
11 | XnUInt8* pSrcEnd = pSrc + nBufferSize; | |
12 | XnUInt8* pDest = NULL; | |
13 | XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize - 1; | |
14 | - XnUInt8* pDestEnd = &pLineBuffer[0] - 1; | |
15 | ||
16 | if (nLineSize > XN_MIRROR_MAX_LINE_SIZE) | |
17 | { | |
18 | @@ -55,7 +54,7 @@ | |
19 | xnOSMemCopy(pLineBuffer, pSrc, nLineSize); | |
20 | ||
21 | pDest = pDestVal; | |
22 | - while (pDest != pDestEnd) | |
23 | + while (pDest >= pLineBuffer) | |
24 | { | |
25 | *pSrc = *pDest; | |
26 | ||
27 | @@ -76,7 +75,6 @@ | |
28 | XnUInt16* pSrcEnd = pSrc + nBufferSize / sizeof(XnUInt16); | |
29 | XnUInt16* pDest = NULL; | |
30 | XnUInt16* pDestVal = &pLineBuffer[0] + nLineSize - 1; | |
31 | - XnUInt16* pDestEnd = &pLineBuffer[0] - 1; | |
32 | XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * sizeof(XnUInt16)); | |
33 | XnUInt16 nValue; | |
34 | ||
35 | @@ -90,7 +88,7 @@ | |
36 | xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize); | |
37 | ||
38 | pDest = pDestVal; | |
39 | - while (pDest != pDestEnd) | |
40 | + while (pDest >= pLineBuffer) | |
41 | { | |
42 | nValue = pDest[0]; | |
43 | pSrc[0] = nValue; | |
44 | @@ -112,7 +110,6 @@ | |
45 | XnUInt8* pSrcEnd = pSrc + nBufferSize; | |
46 | XnUInt8* pDest = NULL; | |
47 | XnUInt8* pDestVal = &pLineBuffer[0] + nLineSize * 3 - 1; | |
48 | - XnUInt8* pDestEnd = &pLineBuffer[0] - 1; | |
49 | XnUInt16 nMemCpyLineSize = (XnUInt16)(nLineSize * 3); | |
50 | ||
51 | if (nMemCpyLineSize > XN_MIRROR_MAX_LINE_SIZE) | |
52 | @@ -125,7 +122,7 @@ | |
53 | xnOSMemCopy(pLineBuffer, pSrc, nMemCpyLineSize); | |
54 | ||
55 | pDest = pDestVal; | |
56 | - while (pDest != pDestEnd) | |
57 | + while (pDest >= pLineBuffer) | |
58 | { | |
59 | *pSrc = *(pDest-2); | |
60 | *(pSrc+1) = *(pDest-1); | |
61 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnFrameStreamProcessor.h.orig 2013-11-12 15:12:23.000000000 +0100 | |
62 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnFrameStreamProcessor.h 2020-03-15 21:15:21.744837994 +0100 | |
63 | @@ -170,8 +170,8 @@ | |
64 | /* A pointer to the triple frame buffer of this stream. */ | |
65 | XnFrameBufferManager* m_pTripleBuffer; | |
66 | ||
67 | - XnChar m_csInDumpMask[100]; | |
68 | - XnChar m_csInternalDumpMask[100]; | |
69 | + XnChar m_csInDumpMask[220]; | |
70 | + XnChar m_csInternalDumpMask[220]; | |
71 | XnDumpFile* m_InDump; | |
72 | XnDumpFile* m_InternalDump; | |
73 | XnBool m_bFrameCorrupted; | |
74 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorFirmwareParams.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
75 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorFirmwareParams.cpp 2020-03-15 21:21:18.092907491 +0100 | |
76 | @@ -262,7 +262,7 @@ | |
77 | nRetVal = m_AllFirmwareParams.Set(&Property, param); | |
78 | XN_IS_STATUS_OK(nRetVal); | |
79 | ||
80 | - XnChar csNewName[XN_DEVICE_MAX_STRING_LENGTH]; | |
81 | + XnChar csNewName[XN_DEVICE_MAX_STRING_LENGTH + 10]; | |
82 | sprintf(csNewName, "%s (%d)", Property.GetName(), nFirmwareParam); | |
83 | ||
84 | Property.UpdateName("Firmware", csNewName); | |
85 | --- OpenNI2-2.2-beta2/Source/Tools/NiViewer/Device.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
86 | +++ OpenNI2-2.2-beta2/Source/Tools/NiViewer/Device.cpp 2020-03-15 22:01:52.709718040 +0100 | |
87 | @@ -364,7 +364,7 @@ | |
88 | ||
89 | void toggleCloseRange(int ) | |
90 | { | |
91 | - bool bCloseRange; | |
92 | + bool bCloseRange = false; | |
93 | g_depthStream.getProperty(XN_STREAM_PROPERTY_CLOSE_RANGE, &bCloseRange); | |
94 | ||
95 | bCloseRange = !bCloseRange; | |
53ed7900 JB |
96 | --- OpenNI2-2.2-beta2/ThirdParty/PSCommon/XnLib/Source/XnProfiling.cpp.orig 2013-11-12 15:12:23.000000000 +0100 |
97 | +++ OpenNI2-2.2-beta2/ThirdParty/PSCommon/XnLib/Source/XnProfiling.cpp 2020-03-16 17:35:12.614316974 +0100 | |
98 | @@ -217,7 +217,8 @@ | |
99 | for (nChar = 0; nChar < gt_nStackDepth*2; ++nChar) | |
100 | pSection->csName[nChar] = ' '; | |
101 | ||
102 | - strncpy(pSection->csName + nChar, csSectionName, MAX_SECTION_NAME); | |
103 | + strncpy(pSection->csName + nChar, csSectionName, MAX_SECTION_NAME-nChar-1); | |
104 | + pSection->csName[MAX_SECTION_NAME-1] = 0; | |
105 | ||
106 | if (strlen(pSection->csName) > g_ProfilingData.nMaxSectionName) | |
107 | g_ProfilingData.nMaxSectionName = strlen(pSection->csName); | |
108 | --- OpenNI2-2.2-beta2/ThirdParty/PSCommon/XnLib/Include/XnString.h.orig 2013-11-12 15:12:23.000000000 +0100 | |
109 | +++ OpenNI2-2.2-beta2/ThirdParty/PSCommon/XnLib/Include/XnString.h 2020-03-16 17:57:12.079217543 +0100 | |
110 | @@ -141,7 +141,7 @@ | |
111 | { | |
112 | ||
113 | Resize(maxCapacity); | |
114 | - strncpy(m_str, str, maxCapacity); | |
115 | + memccpy(m_str, str, 0, maxCapacity); | |
116 | ||
117 | } | |
118 | void Destroy() | |
119 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnDeviceBase.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
120 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnDeviceBase.cpp 2020-03-16 17:58:40.440453170 +0100 | |
121 | @@ -1025,7 +1025,8 @@ | |
122 | ||
123 | // keep the stream name (we now delete the module, so the name will be lost) | |
124 | XnChar strStreamName[XN_DEVICE_MAX_STRING_LENGTH]; | |
125 | - strncpy(strStreamName, StreamName, XN_DEVICE_MAX_STRING_LENGTH); | |
126 | + strncpy(strStreamName, StreamName, XN_DEVICE_MAX_STRING_LENGTH-1); | |
127 | + strStreamName[XN_DEVICE_MAX_STRING_LENGTH-1] = 0; | |
128 | ||
129 | xnl::AutoCSLocker lock(m_hLock); | |
130 | ||
131 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnDeviceModule.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
132 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnDeviceModule.cpp 2020-03-16 17:59:17.422365422 +0100 | |
133 | @@ -37,7 +37,8 @@ | |
134 | m_Lock(XN_MODULE_PROPERTY_LOCK, "Lock", FALSE, strName), | |
135 | m_hLockCS(NULL) | |
136 | { | |
137 | - strncpy(m_strName, strName, XN_DEVICE_MAX_STRING_LENGTH); | |
138 | + strncpy(m_strName, strName, XN_DEVICE_MAX_STRING_LENGTH-1); | |
139 | + m_strName[XN_DEVICE_MAX_STRING_LENGTH-1] = 0; | |
140 | m_Lock.UpdateSetCallback(SetLockStateCallback, this); | |
141 | } | |
142 | ||
143 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnProperty.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
144 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnProperty.cpp 2020-03-16 18:00:07.741633986 +0100 | |
145 | @@ -50,9 +50,11 @@ | |
146 | ||
147 | void XnProperty::UpdateName(const XnChar* strModule, const XnChar* strName) | |
148 | { | |
149 | - strncpy(m_strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH); | |
150 | + strncpy(m_strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH-1); | |
151 | + m_strModule[XN_DEVICE_MAX_STRING_LENGTH-1] = 0; | |
152 | if (m_strName != strName) { | |
153 | - strncpy(m_strName, strName, XN_DEVICE_MAX_STRING_LENGTH); | |
154 | + strncpy(m_strName, strName, XN_DEVICE_MAX_STRING_LENGTH-1); | |
155 | + m_strName[XN_DEVICE_MAX_STRING_LENGTH-1] = 0; | |
156 | } | |
157 | } | |
158 | ||
159 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnPropertySet.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
160 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/DDK/XnPropertySet.cpp 2020-03-16 18:00:49.980484729 +0100 | |
161 | @@ -336,7 +336,8 @@ | |
162 | pEnumer->pModules = pSet->pData; | |
163 | if (strModule != NULL) | |
164 | { | |
165 | - strncpy(pEnumer->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH); | |
166 | + strncpy(pEnumer->strModule, strModule, XN_DEVICE_MAX_STRING_LENGTH-1); | |
167 | + pEnumer->strModule[XN_DEVICE_MAX_STRING_LENGTH-1] = 0; | |
168 | } | |
169 | else | |
170 | { | |
171 | --- OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorStreamHelper.h.orig 2013-11-12 15:12:23.000000000 +0100 | |
172 | +++ OpenNI2-2.2-beta2/Source/Drivers/PS1080/Sensor/XnSensorStreamHelper.h 2020-03-16 18:08:27.534144181 +0100 | |
173 | @@ -113,8 +113,9 @@ | |
174 | XnSensorStreamHelper::ConvertCallback pStreamToFirmwareFunc; | |
175 | XnBool bProcessorProp; | |
176 | ||
177 | - struct | |
178 | + struct TransactionStruct | |
179 | { | |
180 | + TransactionStruct() : bShouldOpen(false), bChooseProcessor(false) {} | |
181 | XnBool bShouldOpen; | |
182 | XnBool bChooseProcessor; | |
183 | } CurrentTransaction; | |
184 | --- OpenNI2-2.2-beta2/Source/Drivers/PSLink/LinkProtoLib/XnLink24zYuv422Parser.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
185 | +++ OpenNI2-2.2-beta2/Source/Drivers/PSLink/LinkProtoLib/XnLink24zYuv422Parser.cpp 2020-03-16 18:13:34.383344763 +0100 | |
186 | @@ -42,7 +42,7 @@ | |
187 | { | |
188 | XnStatus nRetVal = XN_STATUS_OK; | |
189 | ||
190 | - if ((fragmentation | XN_LINK_FRAG_BEGIN) != 0) | |
191 | + if ((fragmentation & XN_LINK_FRAG_BEGIN) != 0) | |
192 | { | |
193 | m_dataFromPrevPacketBytes = 0; | |
194 | m_tempYuvImageBytes = 0; | |
195 | @@ -76,7 +76,7 @@ | |
196 | } | |
197 | ||
198 | XnSizeT actualRead; | |
199 | - nRetVal = Uncompress24z(pInput, inputSize, pOutput, &outputSize, m_lineWidthBytes, &actualRead, (fragmentation | XN_LINK_FRAG_END) == XN_LINK_FRAG_END); | |
200 | + nRetVal = Uncompress24z(pInput, inputSize, pOutput, &outputSize, m_lineWidthBytes, &actualRead, (fragmentation & XN_LINK_FRAG_END) == XN_LINK_FRAG_END); | |
201 | XN_IS_STATUS_OK(nRetVal); | |
202 | ||
203 | pDst += outputSize; | |
204 | @@ -88,7 +88,7 @@ | |
205 | xnOSMemMove(m_dataFromPrevPacket, pInput + actualRead, m_dataFromPrevPacketBytes); | |
206 | } | |
207 | ||
208 | - if ((fragmentation | XN_LINK_FRAG_END) != 0) | |
209 | + if ((fragmentation & XN_LINK_FRAG_END) != 0) | |
210 | { | |
211 | outputSize = pDstEnd - pDst; | |
212 | LinkYuvToRgb::Yuv422ToRgb888(m_tempYuvImage, m_tempYuvImageBytes, pDst, outputSize); | |
213 | --- OpenNI2-2.2-beta2/Samples/SimpleViewer/Viewer.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
214 | +++ OpenNI2-2.2-beta2/Samples/SimpleViewer/Viewer.cpp 2020-03-16 18:17:17.784896912 +0100 | |
215 | @@ -67,7 +67,8 @@ | |
216 | ||
217 | { | |
218 | ms_self = this; | |
219 | - strncpy(m_strSampleName, strSampleName, ONI_MAX_STR); | |
220 | + strncpy(m_strSampleName, strSampleName, ONI_MAX_STR-1); | |
221 | + m_strSampleName[ONI_MAX_STR-1] = 0; | |
222 | } | |
223 | SampleViewer::~SampleViewer() | |
224 | { | |
225 | --- OpenNI2-2.2-beta2/Samples/MultiDepthViewer/Viewer.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
226 | +++ OpenNI2-2.2-beta2/Samples/MultiDepthViewer/Viewer.cpp 2020-03-16 18:17:46.353040845 +0100 | |
227 | @@ -67,7 +67,8 @@ | |
228 | ||
229 | { | |
230 | ms_self = this; | |
231 | - strncpy(m_strSampleName, strSampleName, ONI_MAX_STR); | |
232 | + strncpy(m_strSampleName, strSampleName, ONI_MAX_STR-1); | |
233 | + m_strSampleName[ONI_MAX_STR-1] = 0; | |
234 | } | |
235 | SampleViewer::~SampleViewer() | |
236 | { | |
237 | --- OpenNI2-2.2-beta2/Samples/ClosestPointViewer/Viewer.cpp.orig 2013-11-12 15:12:23.000000000 +0100 | |
238 | +++ OpenNI2-2.2-beta2/Samples/ClosestPointViewer/Viewer.cpp 2020-03-16 18:18:12.364385897 +0100 | |
239 | @@ -57,7 +57,8 @@ | |
240 | ||
241 | { | |
242 | ms_self = this; | |
243 | - strncpy(m_strSampleName, strSampleName, ONI_MAX_STR); | |
244 | + strncpy(m_strSampleName, strSampleName, ONI_MAX_STR-1); | |
245 | + m_strSampleName[ONI_MAX_STR-1] = 0; | |
246 | ||
247 | m_pClosestPoint = new closest_point::ClosestPoint(deviceUri); | |
248 | } |