rpm
5.4.15
Main Page
Related Pages
Data Structures
Files
File List
Globals
rpmdb
header_internal.c
Go to the documentation of this file.
1
/*@-sizeoftype@*/
6
#include "system.h"
7
8
#define _RPMTAG_INTERNAL
9
#include <
header_internal.h
>
10
11
#include "
debug.h
"
12
16
/*@observer@*/
/*@unchecked@*/
17
int
rpm_typeAlign
[16] = {
18
1,
19
1,
20
1,
21
2,
22
4,
23
8,
24
1,
25
1,
26
1,
27
1,
28
0,
29
0,
30
0,
31
0,
32
0,
33
0
34
};
35
36
int
headerVerifyInfo
(
rpmuint32_t
il,
rpmuint32_t
dl,
const
void
* pev,
void
* iv,
int
negate)
37
{
38
/*@-castexpose@*/
39
entryInfo
pe = (
entryInfo
) pev;
40
/*@=castexpose@*/
41
entryInfo
info = (
entryInfo
) iv;
42
rpmuint32_t
i
;
43
44
for
(i = 0; i < il; i++) {
45
info->
tag
= (
rpmTag
) ntohl(pe[i].tag);
46
info->
type
= (
rpmTagType
) ntohl(pe[i].
type
);
47
/* XXX Convert RPMTAG_FILESTATE to RPM_UINT8_TYPE. */
48
if
(info->
tag
== 1029 && info->
type
== 1) {
49
info->
type
=
RPM_UINT8_TYPE
;
50
}
51
info->
offset
= (
rpmint32_t
) ntohl(pe[i].offset);
52
assert(negate || info->
offset
>= 0);
/* XXX insurance */
53
if
(negate)
54
info->
offset
= -info->
offset
;
55
info->
count
= (
rpmuint32_t
) ntohl(pe[i].count);
56
57
if
(
hdrchkType
(info->
type
))
58
return
(
int
)
i
;
59
if
(
hdrchkAlign
(info->
type
, info->
offset
))
60
return
(
int
)
i
;
61
if
(
hdrchkRange
((
rpmint32_t
)dl, info->
offset
))
62
return
(
int
)
i
;
63
if
(
hdrchkData
(info->
count
))
64
return
(
int
)
i
;
65
66
}
67
return
-1;
68
}
69
/*@=sizeoftype@*/
headerVerifyInfo
int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void *pev, void *iv, int negate)
Perform simple sanity and range checks on header tag(s).
Definition:
header_internal.c:36
debug.h
entryInfo_s::type
rpmTagType type
Definition:
header_internal.h:58
RPM_UINT8_TYPE
Definition:
rpmtag.h:30
entryInfo_s::tag
rpmTag tag
Definition:
header_internal.h:57
header_internal.h
rpm_typeAlign
int rpm_typeAlign[16]
Alignment needs (and sizeof scalars types) for internal rpm data types.
Definition:
header_internal.c:17
entryInfo_s::count
rpmTagCount count
Definition:
header_internal.h:60
rpmuint32_t
unsigned int rpmuint32_t
Definition:
rpmiotypes.h:28
entryInfo
struct entryInfo_s * entryInfo
Description of tag data.
Definition:
header_internal.h:55
hdrchkRange
#define hdrchkRange(_dl, _off)
Sanity check on range of data offset.
Definition:
header_internal.h:42
rpmTagType
enum rpmTagType_e rpmTagType
Definition:
rpmtag.h:47
hdrchkAlign
#define hdrchkAlign(_type, _off)
Definition:
header_internal.h:37
rpmint32_t
int rpmint32_t
Definition:
rpmiotypes.h:33
i
const char const int i
Definition:
bson.h:778
type
const char char type
Definition:
bson.h:908
hdrchkData
#define hdrchkData(_nbytes)
Sanity check on data size and/or offset and/or count.
Definition:
header_internal.h:30
entryInfo_s::offset
rpmint32_t offset
Definition:
header_internal.h:59
entryInfo_s
Definition:
header_internal.h:56
rpmTag
enum rpmTag_e rpmTag
Definition:
rpmtag.h:470
hdrchkType
#define hdrchkType(_type)
Sanity check on type values.
Definition:
header_internal.h:24
Generated by
1.8.8