Bug Summary

File:home/maarten/src/libreoffice/core/filter/source/graphicfilter/icgm/class7.cxx
Warning:line 138, column 25
Value stored to 'pAppData' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name class7.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/filter/source/graphicfilter/icgm/class7.cxx
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <sal/config.h>
21
22#include <o3tl/safeint.hxx>
23
24#include "cgm.hxx"
25#include "chart.hxx"
26#include "outact.hxx"
27
28
29void CGM::ImplDoClass7()
30{
31 switch ( mnElementID )
32 {
33 case 0x01 : /*Message */break;
34 case 0x02 :
35 {
36 if (mpEndValidSource - mpSource < 12)
37 throw css::uno::Exception("attempt to read past end of input", nullptr);
38
39 sal_uInt16* pTemp = reinterpret_cast<sal_uInt16*>(mpSource);
40 sal_uInt16 nOpcode = pTemp[ 4 ];
41
42 sal_uInt8* pAppData = mpSource + 12;
43
44 if ( mpChart || ( nOpcode == 0 ) )
45 {
46 switch ( nOpcode )
47 {
48 case 0x000 : /*AppData - Beginning of File Opcodes*/
49 {
50 if (mpEndValidSource - pAppData < 4)
51 throw css::uno::Exception("attempt to read past end of input", nullptr);
52
53 if ( mpChart == nullptr )
54 mpChart.reset( new CGMChart );
55 mpChart->mnCurrentFileType = pAppData[ 3 ];
56 }
57 break;
58 case 0x001 : /*AppData - End of File Opcodes */break;
59 case 0x190 : /*AppData - FDESC */break;
60 case 0x192 : /*AppData - FNOTES */break;
61 case 0x1F4 : /*AppData - BOGENFILE */break;
62 case 0x1F5 : /*AppData - EOGENFILE */break;
63 case 0x1F8 : /*AppData - BOCHTGROUP */break;
64 case 0x1F9 : /*AppData - EOCHTGROUP */break;
65 case 0x1FC : /*AppData - BOCHTDATA */break;
66 case 0x1FD : /*AppData - EOCHTDATA*/
67 {
68 // mpOutAct->DrawChart();
69 }
70 break;
71 case 0x200 : /*AppData - BOSYMGROUP */break;
72 case 0x201 : /*AppData - EOSYMGROUP */break;
73 case 0x204 : /*AppData - BEGSYMBOL */break;
74 case 0x205 : /*AppData - ENDSYMBOL */break;
75 case 0x208 : /*AppData - BOSHWGROUP */break;
76 case 0x209 : /*AppData - EOSHWGROUP */break;
77 case 0x260 : /*AppData - BEGGROUP */break;
78 case 0x262 : /*AppData - ENDGROUP */break;
79 case 0x264 : /*AppData - DATANODE*/
80 {
81 if (o3tl::make_unsigned(mpEndValidSource - pAppData) < sizeof(DataNode))
82 throw css::uno::Exception("attempt to read past end of input", nullptr);
83
84 mpChart->mDataNode[ 0 ] = *reinterpret_cast<DataNode*>( pAppData );
85 sal_Int8 nZoneEnum = mpChart->mDataNode[ 0 ].nZoneEnum;
86 if (nZoneEnum > 0 && nZoneEnum <= 6)
87 mpChart->mDataNode[ nZoneEnum ] = *reinterpret_cast<DataNode*>( pAppData );
88 }
89 break;
90 case 0x2BE : /*AppData - SHWSLIDEREC*/
91 {
92 if (mpEndValidSource - pAppData < 16)
93 throw css::uno::Exception("attempt to read past end of input", nullptr);
94
95 if ( pAppData[ 16 ] == 0 ) // a blank template ?
96 {
97 if ( pAppData[ 2 ] == 46 )
98 {
99 // this starts the document -> maybe we could insert a new document
100 }
101 else if ( pAppData[ 2 ] & 0x80 )
102 {
103 // this is a template
104 }
105 else
106 {
107 mpOutAct->InsertPage();
108 }
109 }
110 mpChart->ResetAnnotation();
111 }
112 break;
113 case 0x2C0 : /*AppData - SHWKEYTABLE */break;
114 case 0x2C2 : /*AppData - SHWBUTTONTAB */break;
115 case 0x2C4 : /*AppData - SHWGLOBAL */break;
116 case 0x2C6 : /*AppData - SHWTITLE */break;
117 case 0x2CA : /*AppData - SHWAPP */break;
118 case 0x320 : /*AppData - TEXT*/
119 {
120 if (mpEndValidSource - pAppData < 9)
121 throw css::uno::Exception("attempt to read past end of input", nullptr);
122
123 std::unique_ptr<TextEntry> pTextEntry(new TextEntry);
124 pTextEntry->nTypeOfText = *reinterpret_cast<sal_uInt16*>( pAppData );
125 pTextEntry->nRowOrLineNum = *reinterpret_cast<sal_uInt16*>( pAppData + 2 );
126 pTextEntry->nColumnNum = *reinterpret_cast<sal_uInt16*>( pAppData + 4 );
127 sal_uInt16 nAttributes = *reinterpret_cast<sal_uInt16*>( pAppData + 6 );
128 pTextEntry->nZoneSize = nAttributes & 0xff;
129 pTextEntry->nLineType = ( nAttributes >> 8 ) & 0xf;
130 nAttributes >>= 12;
131 pTextEntry->nAttributes = nAttributes;
132 pAppData += 8;
133 auto nMaxLen = mpEndValidSource - pAppData;
134 sal_uInt32 nLen = strnlen(reinterpret_cast<char*>(pAppData), nMaxLen);
135 pTextEntry->pText = new char[nLen + 1];
136 memcpy( pTextEntry->pText, pAppData, nLen );
137 pTextEntry->pText[nLen] = 0;
138 pAppData += nLen;
Value stored to 'pAppData' is never read
139
140 mpChart->InsertTextEntry( std::move(pTextEntry) );
141 }
142 break;
143 case 0x321 : /*AppData - IOC_TABS */break;
144 case 0x322 : /*AppData - CHARTZONE*/
145 break;
146 case 0x324 : /*AppData - TITLEZONE */break;
147 case 0x328 : /*AppData - FOOTNOTEZONE */break;
148 case 0x32A : /*AppData - LEGENDZONE */break;
149 case 0x330 : /*AppData - PAGEORIENTDIM*/
150 break;
151 case 0x334 : /*AppData - CHTZONEOPTN*/
152 break;
153 case 0x336 : /*AppData - CHTINTL*/
154 break;
155 case 0x338 : /*AppData - CHTLINESPC */break;
156 case 0x384 : /*AppData - ORGGRIDSTATE */break;
157 case 0x386 : /*AppData - ORGSCRSTATE */break;
158 case 0x388 : /*AppData - ORGTREESTATE */break;
159 case 0x38A : /*AppData - ORGTEXTOPTN */break;
160 case 0x38E : /*AppData - ORGBOXOPTN */break;
161 case 0x390 : /*AppData - ORGBOXDIM */break;
162 case 0x392 : /*AppData - ORGBOX */break;
163 case 0x3EA : /*AppData - TTLTEXTOPTN */break;
164 case 0x3EE : /*AppData - TTLAUTOBUILD */break;
165 case 0x44E : /*AppData - BULTEXTOPTN */break;
166 case 0x452 : /*AppData - BULLETOPTN*/
167 break;
168 case 0x454 : /*AppData - BULLETLINES*/break;
169 case 0x456 : /*AppData - BULAUTOBUILD */break;
170 case 0x4B2 : /*AppData - TBLTEXTOPTN */break;
171 case 0x4B6 : /*AppData - TBLOPTN */break;
172 case 0x4B8 : /*AppData - TBLCOLOPTN */break;
173 case 0x4BA : /*AppData - TBLLEGENDOPTN */break;
174 case 0x4BC : /*AppData - TBLRANGEOPTN */break;
175 case 0x4BE : /*AppData - TBLROWOPTN */break;
176 case 0x4C0 : /*AppData - TBLAUTOBUILD */break;
177 case 0x518 : /*AppData - PIECHARTOPTN */break;
178 case 0x51A : /*AppData - PIELEGENDOPTN */break;
179 case 0x51C : /*AppData - PIETEXTOPTN */break;
180 case 0x51E : /*AppData - PIEOPTN */break;
181 case 0x520 : /*AppData - PIEPCTLABOPTN */break;
182 case 0x522 : /*AppData - PIEVALLABOPTN */break;
183 case 0x524 : /*AppData - PIESLICE */break;
184 case 0x57A : /*AppData - XYAXISOPTN */break;
185 case 0x57C : /*AppData - XYGRIDOPTN */break;
186 case 0x57D : /*AppData - XYGRIDSHOWFILL */break;
187 case 0x57E : /*AppData - XYSERIESOPTN */break;
188 case 0x580 : /*AppData - XYSTYLEOPTN */break;
189 case 0x582 : /*AppData - XYTABLEOPTN */break;
190 case 0x584 : /*AppData - XYTEXTOPTN */break;
191 case 0x586 : /*AppData - XYDATAOPTN */break;
192 case 0x58A : /*AppData - XYLEGENDOPN */break;
193 case 0x58C : /*AppData - XYCALCULATION */break;
194 case 0x58E : /*AppData - XYXVALUE */break;
195 case 0x590 : /*AppData - XYYVALUE */break;
196 case 0x592 : /*AppData - XYXEXTVALUE */break;
197 case 0x618 : /*AppData - IOC_CHTCOLRTAB */break;
198 case 0x619 : /*AppData - IOC_CHTFONTTAB */break;
199 case 0x1fff : /*AppData - 0x1fff */break;
200 default : /*UNKNOWN Application Data */break;
201 }
202 }
203 mnParaSize = mnElementSize;
204 break;
205 }
206 default: break;
207 }
208};
209
210/* vim:set shiftwidth=4 softtabstop=4 expandtab: */