Bug Summary

File:bridges/source/cpp_uno/shared/types.cxx
Location:line 101, column 17
Description:Access to field 'eTypeClass' results in a dereference of a null pointer (loaded from variable 't')

Annotated Source Code

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
21#include "bridges/cpp_uno/shared/types.hxx"
22#define INCLUDED_BRIDGES_CPP_UNO_SHARED_VTABLES_HXX
23
24#include "typelib/typeclass.h"
25#include "typelib/typedescription.h"
26
27namespace bridges { namespace cpp_uno { namespace shared {
28
29bool isSimpleType(typelib_TypeClass typeClass) {
30 return typeClass <= typelib_TypeClass_DOUBLE
31 || typeClass == typelib_TypeClass_ENUM;
32}
33
34bool isSimpleType(typelib_TypeDescriptionReference const * type) {
35 return isSimpleType(type->eTypeClass);
36}
37
38bool isSimpleType(typelib_TypeDescription const * type) {
39 return isSimpleType(type->eTypeClass);
40}
41
42bool relatesToInterfaceType(typelib_TypeDescription const * type) {
43 switch (type->eTypeClass) {
1
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 84
4
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 84
7
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 84
10
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 84
13
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 84
44 case typelib_TypeClass_ANY:
45 case typelib_TypeClass_INTERFACE:
46 return true;
47
48 case typelib_TypeClass_STRUCT:
49 case typelib_TypeClass_EXCEPTION:
50 {
51 typelib_CompoundTypeDescription const * p
52 = reinterpret_cast< typelib_CompoundTypeDescription const * >(
53 type);
54 for (sal_Int32 i = 0; i < p->nMembers; ++i) {
55 switch (p->ppTypeRefs[i]->eTypeClass) {
56 case typelib_TypeClass_ANY:
57 case typelib_TypeClass_INTERFACE:
58 return true;
59
60 case typelib_TypeClass_STRUCT:
61 case typelib_TypeClass_EXCEPTION:
62 case typelib_TypeClass_SEQUENCE:
63 {
64 typelib_TypeDescription * t = 0;
65 TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]){ typelib_TypeDescriptionReference * pMacroTypeRef = (p->ppTypeRefs
[i]); typelib_TypeDescription ** ppMacroTypeDescr = (&t);
if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef
->pType->pWeakRef) { typelib_typedescriptionreference_getDescription
( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release
( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef
->pType; } }
;
66 bool b = relatesToInterfaceType(t);
67 TYPELIB_DANGER_RELEASE(t){ if ((((t)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| ((t)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) typelib_typedescription_release( t ); }
;
68 if (b) {
69 return true;
70 }
71 }
72 break;
73
74 default:
75 break;
76 }
77 }
78 if (p->pBaseTypeDescription != 0) {
79 return relatesToInterfaceType(&p->pBaseTypeDescription->aBase);
80 }
81 }
82 break;
83
84 case typelib_TypeClass_SEQUENCE:
85 switch (reinterpret_cast< typelib_IndirectTypeDescription const * >(
2
Control jumps to 'case typelib_TypeClass_STRUCT:' at line 91
5
Control jumps to 'case typelib_TypeClass_STRUCT:' at line 91
8
Control jumps to 'case typelib_TypeClass_STRUCT:' at line 91
11
Control jumps to 'case typelib_TypeClass_STRUCT:' at line 91
14
Control jumps to 'case typelib_TypeClass_SEQUENCE:' at line 93
86 type)->pType->eTypeClass) {
87 case typelib_TypeClass_ANY:
88 case typelib_TypeClass_INTERFACE:
89 return true;
90
91 case typelib_TypeClass_STRUCT:
92 case typelib_TypeClass_EXCEPTION:
93 case typelib_TypeClass_SEQUENCE:
94 {
95 typelib_TypeDescription * t = 0;
96 TYPELIB_DANGER_GET({ typelib_TypeDescriptionReference * pMacroTypeRef = (reinterpret_cast
< typelib_IndirectTypeDescription const * >( type)->
pType); typelib_TypeDescription ** ppMacroTypeDescr = (&t
); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef
->pType->pWeakRef) { typelib_typedescriptionreference_getDescription
( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release
( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef
->pType; } }
97 &t,{ typelib_TypeDescriptionReference * pMacroTypeRef = (reinterpret_cast
< typelib_IndirectTypeDescription const * >( type)->
pType); typelib_TypeDescription ** ppMacroTypeDescr = (&t
); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef
->pType->pWeakRef) { typelib_typedescriptionreference_getDescription
( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release
( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef
->pType; } }
98 reinterpret_cast< typelib_IndirectTypeDescription const * >({ typelib_TypeDescriptionReference * pMacroTypeRef = (reinterpret_cast
< typelib_IndirectTypeDescription const * >( type)->
pType); typelib_TypeDescription ** ppMacroTypeDescr = (&t
); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef
->pType->pWeakRef) { typelib_typedescriptionreference_getDescription
( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release
( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef
->pType; } }
99 type)->pType){ typelib_TypeDescriptionReference * pMacroTypeRef = (reinterpret_cast
< typelib_IndirectTypeDescription const * >( type)->
pType); typelib_TypeDescription ** ppMacroTypeDescr = (&t
); if (((pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| (pMacroTypeRef->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) { typelib_typedescriptionreference_getDescription( ppMacroTypeDescr
, pMacroTypeRef ); } else if (!pMacroTypeRef->pType || !pMacroTypeRef
->pType->pWeakRef) { typelib_typedescriptionreference_getDescription
( ppMacroTypeDescr, pMacroTypeRef ); if (*ppMacroTypeDescr) typelib_typedescription_release
( *ppMacroTypeDescr ); } else { *ppMacroTypeDescr = pMacroTypeRef
->pType; } }
;
100 bool b = relatesToInterfaceType(t);
3
Calling 'relatesToInterfaceType'
6
Calling 'relatesToInterfaceType'
9
Calling 'relatesToInterfaceType'
12
Calling 'relatesToInterfaceType'
101 TYPELIB_DANGER_RELEASE(t){ if ((((t)->eTypeClass) == typelib_TypeClass_INTERFACE_METHOD
|| ((t)->eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE
)) typelib_typedescription_release( t ); }
;
15
Within the expansion of the macro 'TYPELIB_DANGER_RELEASE':
a
Access to field 'eTypeClass' results in a dereference of a null pointer (loaded from variable 't')
102 return b;
103 }
104
105 default:
106 break;
107 }
108 break;
109
110 default:
111 break;
112 }
113 return false;
114}
115
116} } }
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */