00001
00006 #include "system.h"
00007
00008 #define _RPMTAG_INTERNAL
00009 #include <header_internal.h>
00010
00011 #include "debug.h"
00012
00016
00017 int rpm_typeAlign[16] = {
00018 1,
00019 1,
00020 1,
00021 2,
00022 4,
00023 8,
00024 1,
00025 1,
00026 1,
00027 1,
00028 0,
00029 0,
00030 0,
00031 0,
00032 0,
00033 0
00034 };
00035
00036 int headerVerifyInfo(uint32_t il, uint32_t dl, const void * pev, void * iv, int negate)
00037 {
00038
00039 entryInfo pe = (entryInfo) pev;
00040
00041 entryInfo info = iv;
00042 uint32_t i;
00043
00044 for (i = 0; i < il; i++) {
00045 info->tag = (uint32_t) ntohl(pe[i].tag);
00046 info->type = (uint32_t) ntohl(pe[i].type);
00047
00048 if (info->tag == 1029 && info->type == 1) {
00049 info->type = RPM_UINT8_TYPE;
00050 pe[i].type = (uint32_t) htonl(info->type);
00051 }
00052 info->offset = (int32_t) ntohl(pe[i].offset);
00053 assert(negate || info->offset >= 0);
00054 if (negate)
00055 info->offset = -info->offset;
00056 info->count = (uint32_t) ntohl(pe[i].count);
00057
00058 if (hdrchkType(info->type))
00059 return (int)i;
00060 if (hdrchkAlign(info->type, info->offset))
00061 return (int)i;
00062 if (!negate && hdrchkRange((int32_t)dl, info->offset))
00063 return (int)i;
00064 if (hdrchkData(info->count))
00065 return (int)i;
00066
00067 }
00068 return -1;
00069 }
00070