header_internal.c
Go to the documentation of this file.
/*@-sizeoftype@*/
#include "system.h"
#define _RPMTAG_INTERNAL
#include <header_internal.h>
#include "debug.h"
/*@observer@*/ /*@unchecked@*/
int rpm_typeAlign[16] = {
1,
1,
1,
2,
4,
8,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0
};
int headerVerifyInfo(rpmuint32_t il, rpmuint32_t dl, const void * pev, void * iv, int negate)
{
/*@-castexpose@*/
entryInfo pe = (entryInfo) pev;
/*@=castexpose@*/
entryInfo info = iv;
rpmuint32_t i;
for (i = 0; i < il; i++) {
info->tag = (rpmuint32_t) ntohl(pe[i].tag);
info->type = (rpmuint32_t) ntohl(pe[i].type);
/* XXX Convert RPMTAG_FILESTATE to RPM_UINT8_TYPE. */
if (info->tag == 1029 && info->type == 1) {
info->type = RPM_UINT8_TYPE;
pe[i].type = (rpmuint32_t) htonl(info->type);
}
info->offset = (rpmint32_t) ntohl(pe[i].offset);
assert(negate || info->offset >= 0); /* XXX insurance */
if (negate)
info->offset = -info->offset;
info->count = (rpmuint32_t) ntohl(pe[i].count);
if (hdrchkType(info->type))
return (int)i;
if (hdrchkAlign(info->type, info->offset))
return (int)i;
if (!negate && hdrchkRange((rpmint32_t)dl, info->offset))
return (int)i;
if (hdrchkData(info->count))
return (int)i;
}
return -1;
}
/*@=sizeoftype@*/