47 static unsigned char *
_zip_memmem(
const unsigned char *,
size_t,
const unsigned char *,
size_t);
84 if (_flags < 0 ||
src ==
NULL) {
277 if (
cd->offset +
cd->size > buf_offset + eocd_offset) {
304 if (
cd->offset >= buf_offset) {
343 if (
i ==
cd->nentry) {
374 if (
i !=
cd->nentry || left > 0) {
425 max =
cd->entry[0].orig->offset;
426 min =
cd->entry[0].orig->offset;
431 for (
i = 0;
i <
cd->nentry;
i++) {
432 if (
cd->entry[
i].orig->offset <
min)
433 min =
cd->entry[
i].orig->offset;
467 cd->entry[
i].orig->local_extra_fields_read = 1;
630 static unsigned char *
631 _zip_memmem(
const unsigned char *big,
size_t biglen,
const unsigned char *little,
size_t littlelen) {
632 const unsigned char *
p;
634 if ((biglen < littlelen) || (littlelen == 0))
637 while ((
p = (
const unsigned char *)memchr(
p + 1, little[0], (
size_t)(big - (
p + 1)) + (
size_t)(biglen - littlelen) + 1)) !=
NULL) {
638 if (memcmp(
p + 1, little + 1, littlelen - 1) == 0)
639 return (
unsigned char *)
p;
683 if (
offset +
size > buf_offset + eocd_offset) {
697 cd->is_zip64 =
false;
713 zip_uint32_t num_disks, num_disks64, eocd_disk, eocd_disk64;
730 if (eocd_offset +
EOCD64LEN > eocdloc_offset + buf_offset) {
779 if (num_disks == 0xffff) {
780 num_disks = num_disks64;
782 if (eocd_disk == 0xffff) {
783 eocd_disk = eocd_disk64;
785 if ((
flags &
ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) {
792 if (num_disks != 0 || eocd_disk != 0) {
831 if (
offset +
size > buf_offset + eocd_offset) {
unsigned char match[65280+2]
RZ_API void Ht_() free(HtName_(Ht) *ht)
ZIP_EXTERN int zip_source_close(zip_source_t *_Nonnull)
ZIP_EXTERN void zip_error_set(zip_error_t *_Nullable, int, int)
#define ZIP_SOURCE_SUPPORTS_SEEKABLE
#define ZIP_SOURCE_SUPPORTS_WRITABLE
ZIP_EXTERN int zip_error_code_system(const zip_error_t *_Nonnull)
ZIP_EXTERN int zip_source_seek(zip_source_t *_Nonnull, zip_int64_t, int)
ZIP_EXTERN zip_int64_t zip_source_tell(zip_source_t *_Nonnull)
ZIP_EXTERN void zip_stat_init(zip_stat_t *_Nonnull)
ZIP_EXTERN void zip_error_init(zip_error_t *_Nonnull)
ZIP_EXTERN zip_error_t *_Nonnull zip_source_error(zip_source_t *_Nonnull)
ZIP_EXTERN int zip_source_stat(zip_source_t *_Nonnull, zip_stat_t *_Nonnull)
ZIP_EXTERN void zip_discard(zip_t *_Nonnull)
ZIP_EXTERN int zip_source_open(zip_source_t *_Nonnull)
ZIP_EXTERN void zip_error_fini(zip_error_t *_Nonnull)
ZIP_EXTERN int zip_error_code_zip(const zip_error_t *_Nonnull)
ZIP_EXTERN void zip_source_free(zip_source_t *_Nullable)
ZIP_EXTERN int zip_error_system_type(const zip_error_t *_Nonnull)
ZIP_EXTERN void zip_source_keep(zip_source_t *_Nonnull)
ZIP_EXTERN zip_source_t *_Nullable zip_source_file_create(const char *_Nonnull, zip_uint64_t, zip_int64_t, zip_error_t *_Nullable)
static const char struct stat static buf struct stat static buf static idle const char static path static fd const char static len const void static prot const char struct module static image struct kernel_sym static table unsigned char static buf static fsuid unsigned struct dirent unsigned static count const struct iovec static count static pid const void static len static flags const struct sched_param static p static pid static policy struct timespec static tp static suid unsigned fn
while(len< limit &&buf1[len]==buf2[len])++len
static struct sockaddr static addrlen static backlog const void static flags void flags
zip_uint64_t nentry_alloc
zip_uint16_t version_needed
zip_extra_field_t * extra_fields
zip_uint64_t nentry_alloc
zip_string_t * comment_orig
void error(const char *msg)
zip_uint8_t * _zip_buffer_data(zip_buffer_t *buffer)
zip_uint32_t _zip_buffer_get_32(zip_buffer_t *buffer)
zip_uint64_t _zip_buffer_left(zip_buffer_t *buffer)
zip_uint64_t _zip_buffer_size(zip_buffer_t *buffer)
zip_buffer_t * _zip_buffer_new(zip_uint8_t *data, zip_uint64_t size)
void _zip_buffer_free(zip_buffer_t *buffer)
zip_buffer_t * _zip_buffer_new_from_source(zip_source_t *src, zip_uint64_t size, zip_uint8_t *buf, zip_error_t *error)
bool _zip_buffer_ok(zip_buffer_t *buffer)
zip_uint16_t _zip_buffer_get_16(zip_buffer_t *buffer)
bool _zip_buffer_eof(zip_buffer_t *buffer)
zip_uint64_t _zip_buffer_get_64(zip_buffer_t *buffer)
zip_uint64_t _zip_buffer_offset(zip_buffer_t *buffer)
int _zip_buffer_set_offset(zip_buffer_t *buffer, zip_uint64_t offset)
zip_uint8_t * _zip_buffer_get(zip_buffer_t *buffer, zip_uint64_t length)
zip_dirent_t * _zip_dirent_new(void)
void _zip_cdir_free(zip_cdir_t *cd)
void _zip_dirent_init(zip_dirent_t *de)
void _zip_dirent_finalize(zip_dirent_t *zde)
zip_cdir_t * _zip_cdir_new(zip_uint64_t nentry, zip_error_t *error)
zip_int64_t _zip_dirent_read(zip_dirent_t *zde, zip_source_t *src, zip_buffer_t *buffer, bool local, zip_error_t *error)
bool _zip_cdir_grow(zip_cdir_t *cd, zip_uint64_t additional_entries, zip_error_t *error)
void _zip_error_set_from_source(zip_error_t *err, zip_source_t *src)
void _zip_error_copy(zip_error_t *dst, const zip_error_t *src)
bool _zip_hash_reserve_capacity(zip_hash_t *hash, zip_uint64_t capacity, zip_error_t *error)
bool _zip_hash_add(zip_hash_t *hash, const zip_uint8_t *name, zip_uint64_t index, zip_flags_t flags, zip_error_t *error)
zip_t * _zip_new(zip_error_t *error)
static zip_t * _zip_allocate_new(zip_source_t *src, unsigned int flags, zip_error_t *error)
zip_t * _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error)
static zip_int64_t _zip_checkcons(zip_t *za, zip_cdir_t *cdir, zip_error_t *error)
ZIP_EXTERN zip_t * zip_open_from_source(zip_source_t *src, int _flags, zip_error_t *error)
static zip_cdir_t * _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error)
static zip_cdir_t * _zip_find_central_dir(zip_t *za, zip_uint64_t len)
static zip_cdir_t * _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_error_t *error)
static exists_t _zip_file_exists(zip_source_t *src, zip_error_t *error)
static int _zip_headercomp(const zip_dirent_t *, const zip_dirent_t *)
static unsigned char * _zip_memmem(const unsigned char *, size_t, const unsigned char *, size_t)
static zip_cdir_t * _zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error)
void _zip_set_open_error(int *zep, const zip_error_t *err, int ze)
ZIP_EXTERN zip_t * zip_open(const char *fn, int _flags, int *zep)
bool zip_source_accept_empty(zip_source_t *src)
zip_int64_t zip_source_supports(zip_source_t *src)
zip_string_t * _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error)
const zip_uint8_t * _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error)
int _zip_string_equal(const zip_string_t *a, const zip_string_t *b)
zip_uint16_t _zip_string_length(const zip_string_t *s)
#define ZIP_ER_DETAIL_EOCD64_OVERLAPS_EOCD
#define ZIP_ER_DETAIL_CDIR_WRONG_ENTRIES_COUNT
#define ZIP_ER_DETAIL_EOCD64_WRONG_MAGIC
#define MAKE_DETAIL_WITH_INDEX(error, index)
#define ZIP_ER_DETAIL_CDIR_LENGTH_INVALID
#define ZIP_ER_DETAIL_EOCD64_MISMATCH
#define ZIP_ER_DETAIL_CDIR_OVERLAPS_EOCD
#define ZIP_ER_DETAIL_CDIR_INVALID
#define ADD_INDEX_TO_DETAIL(error, index)
#define ZIP_ER_DETAIL_ENTRY_HEADER_MISMATCH
#define ZIP_GPBF_DATA_DESCRIPTOR
#define ZIP_ER_DETAIL_CDIR_ENTRY_INVALID
#define ZIP_ER_DETAIL_COMMENT_LENGTH_INVALID
#define ZIP_ER_DETAIL_EOCD_LENGTH_INVALID