func
stringlengths
269
194k
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static bool create_db_dir(char *fnam) { int ret; char *p; p = alloca(strlen(fnam) + 1); strcpy(p, fnam); fnam = p; p = p + 1; again: while (*p && *p != '/') p++; if (!*p) return true; *p = '\0'; ret = mkdir(fnam, 0755); if (ret < 0 && errno != EEXIST) { usernic_error("Failed to create %s: %s\n", fnam, strerror(errno)); *p = '/'; return false; } *(p++) = '/'; goto again; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [message_send_groupchat_subject(const char *const roomjid, const char *const subject) { xmpp_ctx_t * const ctx = connection_get_ctx(); xmpp_stanza_t *message = stanza_create_room_subject_message(ctx, roomjid, subject); _send_message_stanza(message); xmpp_stanza_release(message); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [hstore_from_record(PG_FUNCTION_ARGS) { HeapTupleHeader rec; int32 buflen; HStore *out; Pairs *pairs; Oid tupType; int32 tupTypmod; TupleDesc tupdesc; HeapTupleData tuple; RecordIOData *my_extra; int ncolumns; int i, j; Datum *values; bool *nulls; if (PG_ARGISNULL(0)) { Oid argtype = get_fn_expr_argtype(fcinfo->flinfo, 0); /* * have no tuple to look at, so the only source of type info is the * argtype. The lookup_rowtype_tupdesc call below will error out if we * don't have a known composite type oid here. */ tupType = argtype; tupTypmod = -1; rec = NULL; } else { rec = PG_GETARG_HEAPTUPLEHEADER(0); /* Extract type info from the tuple itself */ tupType = HeapTupleHeaderGetTypeId(rec); tupTypmod = HeapTupleHeaderGetTypMod(rec); } tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod); ncolumns = tupdesc->natts; /* * We arrange to look up the needed I/O info just once per series of * calls, assuming the record type doesn't change underneath us. */ my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra; if (my_extra == NULL || my_extra->ncolumns != ncolumns) { fcinfo->flinfo->fn_extra = MemoryContextAlloc(fcinfo->flinfo->fn_mcxt, sizeof(RecordIOData) - sizeof(ColumnIOData) + ncolumns * sizeof(ColumnIOData)); my_extra = (RecordIOData *) fcinfo->flinfo->fn_extra; my_extra->record_type = InvalidOid; my_extra->record_typmod = 0; } if (my_extra->record_type != tupType || my_extra->record_typmod != tupTypmod) { MemSet(my_extra, 0, sizeof(RecordIOData) - sizeof(ColumnIOData) + ncolumns * sizeof(ColumnIOData)); my_extra->record_type = tupType; my_extra->record_typmod = tupTypmod; my_extra->ncolumns = ncolumns; } pairs = palloc(ncolumns * sizeof(Pairs)); if (rec) { /* Build a temporary HeapTuple control structure */ tuple.t_len = HeapTupleHeaderGetDatumLength(rec); ItemPointerSetInvalid(&(tuple.t_self)); tuple.t_tableOid = InvalidOid; tuple.t_data = rec; values = (Datum *) palloc(ncolumns * sizeof(Datum)); nulls = (bool *) palloc(ncolumns * sizeof(bool)); /* Break down the tuple into fields */ heap_deform_tuple(&tuple, tupdesc, values, nulls); } else { values = NULL; nulls = NULL; } for (i = 0, j = 0; i < ncolumns; ++i) { ColumnIOData *column_info = &my_extra->columns[i]; Oid column_type = tupdesc->attrs[i]->atttypid; char *value; /* Ignore dropped columns in datatype */ if (tupdesc->attrs[i]->attisdropped) continue; pairs[j].key = NameStr(tupdesc->attrs[i]->attname); pairs[j].keylen = hstoreCheckKeyLen(strlen(NameStr(tupdesc->attrs[i]->attname))); if (!nulls || nulls[i]) { pairs[j].val = NULL; pairs[j].vallen = 4; pairs[j].isnull = true; pairs[j].needfree = false; ++j; continue; } /* * Convert the column value to text */ if (column_info->column_type != column_type) { bool typIsVarlena; getTypeOutputInfo(column_type, &column_info->typiofunc, &typIsVarlena); fmgr_info_cxt(column_info->typiofunc, &column_info->proc, fcinfo->flinfo->fn_mcxt); column_info->column_type = column_type; } value = OutputFunctionCall(&column_info->proc, values[i]); pairs[j].val = value; pairs[j].vallen = hstoreCheckValLen(strlen(value)); pairs[j].isnull = false; pairs[j].needfree = false; ++j; } ncolumns = hstoreUniquePairs(pairs, j, &buflen); out = hstorePairs(pairs, ncolumns, buflen); ReleaseTupleDesc(tupdesc); PG_RETURN_POINTER(out); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); qtest_add_func("fuzz/lsi53c895a/lsi_do_dma_empty_queue", test_lsi_do_dma_empty_queue); return g_test_run(); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int cine_read_packet(AVFormatContext *avctx, AVPacket *pkt) { CineDemuxContext *cine = avctx->priv_data; AVStream *st = avctx->streams[0]; AVIOContext *pb = avctx->pb; int n, size, ret; if (cine->pts >= st->duration) return AVERROR_EOF; avio_seek(pb, st->index_entries[cine->pts].pos, SEEK_SET); n = avio_rl32(pb); if (n < 8) return AVERROR_INVALIDDATA; avio_skip(pb, n - 8); size = avio_rl32(pb); ret = av_get_packet(pb, pkt, size); if (ret < 0) return ret; pkt->pts = cine->pts++; pkt->stream_index = 0; pkt->flags |= AV_PKT_FLAG_KEY; return 0; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVQcowState *s = bs->opaque; int len, i, ret = 0; QCowHeader header; QemuOpts *opts; Error *local_err = NULL; uint64_t ext_end; uint64_t l1_vm_state_index; const char *opt_overlap_check; int overlap_check_template = 0; ret = bdrv_pread(bs->file, 0, &header, sizeof(header)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read qcow2 header"); goto fail; } be32_to_cpus(&header.magic); be32_to_cpus(&header.version); be64_to_cpus(&header.backing_file_offset); be32_to_cpus(&header.backing_file_size); be64_to_cpus(&header.size); be32_to_cpus(&header.cluster_bits); be32_to_cpus(&header.crypt_method); be64_to_cpus(&header.l1_table_offset); be32_to_cpus(&header.l1_size); be64_to_cpus(&header.refcount_table_offset); be32_to_cpus(&header.refcount_table_clusters); be64_to_cpus(&header.snapshots_offset); be32_to_cpus(&header.nb_snapshots); if (header.magic != QCOW_MAGIC) { error_setg(errp, "Image is not in qcow2 format"); ret = -EINVAL; goto fail; } if (header.version < 2 || header.version > 3) { report_unsupported(bs, errp, "QCOW version %d", header.version); ret = -ENOTSUP; goto fail; } s->qcow_version = header.version; /* Initialise cluster size */ if (header.cluster_bits < MIN_CLUSTER_BITS || header.cluster_bits > MAX_CLUSTER_BITS) { error_setg(errp, "Unsupported cluster size: 2^%i", header.cluster_bits); ret = -EINVAL; goto fail; } s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; s->cluster_sectors = 1 << (s->cluster_bits - 9); /* Initialise version 3 header fields */ if (header.version == 2) { header.incompatible_features = 0; header.compatible_features = 0; header.autoclear_features = 0; header.refcount_order = 4; header.header_length = 72; } else { be64_to_cpus(&header.incompatible_features); be64_to_cpus(&header.compatible_features); be64_to_cpus(&header.autoclear_features); be32_to_cpus(&header.refcount_order); be32_to_cpus(&header.header_length); if (header.header_length < 104) { error_setg(errp, "qcow2 header too short"); ret = -EINVAL; goto fail; } } if (header.header_length > s->cluster_size) { error_setg(errp, "qcow2 header exceeds cluster size"); ret = -EINVAL; goto fail; } if (header.header_length > sizeof(header)) { s->unknown_header_fields_size = header.header_length - sizeof(header); s->unknown_header_fields = g_malloc(s->unknown_header_fields_size); ret = bdrv_pread(bs->file, sizeof(header), s->unknown_header_fields, s->unknown_header_fields_size); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read unknown qcow2 header " "fields"); goto fail; } } if (header.backing_file_offset > s->cluster_size) { error_setg(errp, "Invalid backing file offset"); ret = -EINVAL; goto fail; } if (header.backing_file_offset) { ext_end = header.backing_file_offset; } else { ext_end = 1 << header.cluster_bits; } /* Handle feature bits */ s->incompatible_features = header.incompatible_features; s->compatible_features = header.compatible_features; s->autoclear_features = header.autoclear_features; if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) { void *feature_table = NULL; qcow2_read_extensions(bs, header.header_length, ext_end, &feature_table, NULL); report_unsupported_feature(bs, errp, feature_table, s->incompatible_features & ~QCOW2_INCOMPAT_MASK); ret = -ENOTSUP; g_free(feature_table); goto fail; } if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { /* Corrupt images may not be written to unless they are being repaired */ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "qcow2: Image is corrupt; cannot be opened " "read/write"); ret = -EACCES; goto fail; } } /* Check support for various header values */ if (header.refcount_order != 4) { report_unsupported(bs, errp, "%d bit reference counts", 1 << header.refcount_order); ret = -ENOTSUP; goto fail; } s->refcount_order = header.refcount_order; if (header.crypt_method > QCOW_CRYPT_AES) { error_setg(errp, "Unsupported encryption method: %i", header.crypt_method); ret = -EINVAL; goto fail; } s->crypt_method_header = header.crypt_method; if (s->crypt_method_header) { bs->encrypted = 1; } s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */ s->l2_size = 1 << s->l2_bits; bs->total_sectors = header.size / 512; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; s->refcount_table_offset = header.refcount_table_offset; s->refcount_table_size = header.refcount_table_clusters << (s->cluster_bits - 3); s->snapshots_offset = header.snapshots_offset; s->nb_snapshots = header.nb_snapshots; /* read the level 1 table */ s->l1_size = header.l1_size; l1_vm_state_index = size_to_l1(s, header.size); if (l1_vm_state_index > INT_MAX) { error_setg(errp, "Image is too big"); ret = -EFBIG; goto fail; } s->l1_vm_state_index = l1_vm_state_index; /* the L1 table must contain at least enough entries to put header.size bytes */ if (s->l1_size < s->l1_vm_state_index) { error_setg(errp, "L1 table is too small"); ret = -EINVAL; goto fail; } s->l1_table_offset = header.l1_table_offset; if (s->l1_size > 0) { s->l1_table = g_malloc0( align_offset(s->l1_size * sizeof(uint64_t), 512)); ret = bdrv_pread(bs->file, s->l1_table_offset, s->l1_table, s->l1_size * sizeof(uint64_t)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read L1 table"); goto fail; } for(i = 0;i < s->l1_size; i++) { be64_to_cpus(&s->l1_table[i]); } } /* alloc L2 table/refcount block cache */ s->l2_table_cache = qcow2_cache_create(bs, L2_CACHE_SIZE); s->refcount_block_cache = qcow2_cache_create(bs, REFCOUNT_CACHE_SIZE); s->cluster_cache = g_malloc(s->cluster_size); /* one more sector for decompressed data alignment */ s->cluster_data = qemu_blockalign(bs, QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size + 512); s->cluster_cache_offset = -1; s->flags = flags; ret = qcow2_refcount_init(bs); if (ret != 0) { error_setg_errno(errp, -ret, "Could not initialize refcount handling"); goto fail; } QLIST_INIT(&s->cluster_allocs); QTAILQ_INIT(&s->discards); /* read qcow2 extensions */ if (qcow2_read_extensions(bs, header.header_length, ext_end, NULL, &local_err)) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } /* read the backing file name */ if (header.backing_file_offset != 0) { len = header.backing_file_size; if (len > 1023) { len = 1023; } ret = bdrv_pread(bs->file, header.backing_file_offset, bs->backing_file, len); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read backing file name"); goto fail; } bs->backing_file[len] = '\0'; } ret = qcow2_read_snapshots(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not read snapshots"); goto fail; } /* Clear unknown autoclear feature bits */ if (!bs->read_only && !(flags & BDRV_O_INCOMING) && s->autoclear_features) { s->autoclear_features = 0; ret = qcow2_update_header(bs); if (ret < 0) { error_setg_errno(errp, -ret, "Could not update qcow2 header"); goto fail; } } /* Initialise locks */ qemu_co_mutex_init(&s->lock); /* Repair image if dirty */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INCOMING)) && !bs->read_only && (s->incompatible_features & QCOW2_INCOMPAT_DIRTY)) { BdrvCheckResult result = {0}; ret = qcow2_check(bs, &result, BDRV_FIX_ERRORS); if (ret < 0) { error_setg_errno(errp, -ret, "Could not repair dirty image"); goto fail; } } /* Enable lazy_refcounts according to image and command line options */ opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS, (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS)); s->discard_passthrough[QCOW2_DISCARD_NEVER] = false; s->discard_passthrough[QCOW2_DISCARD_ALWAYS] = true; s->discard_passthrough[QCOW2_DISCARD_REQUEST] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_REQUEST, flags & BDRV_O_UNMAP); s->discard_passthrough[QCOW2_DISCARD_SNAPSHOT] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_SNAPSHOT, true); s->discard_passthrough[QCOW2_DISCARD_OTHER] = qemu_opt_get_bool(opts, QCOW2_OPT_DISCARD_OTHER, false); opt_overlap_check = qemu_opt_get(opts, "overlap-check") ?: "cached"; if (!strcmp(opt_overlap_check, "none")) { overlap_check_template = 0; } else if (!strcmp(opt_overlap_check, "constant")) { overlap_check_template = QCOW2_OL_CONSTANT; } else if (!strcmp(opt_overlap_check, "cached")) { overlap_check_template = QCOW2_OL_CACHED; } else if (!strcmp(opt_overlap_check, "all")) { overlap_check_template = QCOW2_OL_ALL; } else { error_setg(errp, "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all", opt_overlap_check); qemu_opts_del(opts); ret = -EINVAL; goto fail; } s->overlap_check = 0; for (i = 0; i < QCOW2_OL_MAX_BITNR; i++) { /* overlap-check defines a template bitmask, but every flag may be * overwritten through the associated boolean option */ s->overlap_check |= qemu_opt_get_bool(opts, overlap_bool_option_names[i], overlap_check_template & (1 << i)) << i; } qemu_opts_del(opts); if (s->use_lazy_refcounts && s->qcow_version < 3) { error_setg(errp, "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level"); ret = -EINVAL; goto fail; } #ifdef DEBUG_ALLOC { BdrvCheckResult result = {0}; qcow2_check_refcounts(bs, &result, 0); } #endif return ret; fail: g_free(s->unknown_header_fields); cleanup_unknown_header_ext(bs); qcow2_free_snapshots(bs); qcow2_refcount_close(bs); g_free(s->l1_table); /* else pre-write overlap checks in cache_destroy may crash */ s->l1_table = NULL; if (s->l2_table_cache) { qcow2_cache_destroy(bs, s->l2_table_cache); } if (s->refcount_block_cache) { qcow2_cache_destroy(bs, s->refcount_block_cache); } g_free(s->cluster_cache); qemu_vfree(s->cluster_data); return ret; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int i740fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) { switch (var->bits_per_pixel) { case 8: var->red.offset = var->green.offset = var->blue.offset = 0; var->red.length = var->green.length = var->blue.length = 8; break; case 16: switch (var->green.length) { default: case 5: var->red.offset = 10; var->green.offset = 5; var->blue.offset = 0; var->red.length = 5; var->green.length = 5; var->blue.length = 5; break; case 6: var->red.offset = 11; var->green.offset = 5; var->blue.offset = 0; var->red.length = var->blue.length = 5; break; } break; case 24: var->red.offset = 16; var->green.offset = 8; var->blue.offset = 0; var->red.length = var->green.length = var->blue.length = 8; break; case 32: var->transp.offset = 24; var->red.offset = 16; var->green.offset = 8; var->blue.offset = 0; var->transp.length = 8; var->red.length = var->green.length = var->blue.length = 8; break; default: return -EINVAL; } if (var->xres > var->xres_virtual) var->xres_virtual = var->xres; if (var->yres > var->yres_virtual) var->yres_virtual = var->yres; if (info->monspecs.hfmax && info->monspecs.vfmax && info->monspecs.dclkmax && fb_validate_mode(var, info) < 0) return -EINVAL; return 0; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ Event_creation_ctx(CHARSET_INFO *client_cs, CHARSET_INFO *connection_cl, CHARSET_INFO *db_cl) : Stored_program_creation_ctx(client_cs, connection_cl, db_cl) { }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ip_do_one_event(argc, argv, self) int argc; VALUE *argv; VALUE self; { return lib_do_one_event_core(argc, argv, self, 0); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void URI_FUNC(FreeUriMembers)(URI_TYPE(Uri) * uri) { URI_FUNC(FreeUriMembersMm)(uri, NULL); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [SetWALFileNameForCleanup(void) { uint32 tli = 1, log = 0, seg = 0; uint32 log_diff = 0, seg_diff = 0; bool cleanup = false; if (restartWALFileName) { /* * Don't do cleanup if the restartWALFileName provided is later than * the xlog file requested. This is an error and we must not remove * these files from archive. This shouldn't happen, but better safe * than sorry. */ if (strcmp(restartWALFileName, nextWALFileName) > 0) return false; strcpy(exclusiveCleanupFileName, restartWALFileName); return true; } if (keepfiles > 0) { sscanf(nextWALFileName, "%08X%08X%08X", &tli, &log, &seg); if (tli > 0 && seg > 0) { log_diff = keepfiles / MaxSegmentsPerLogFile; seg_diff = keepfiles % MaxSegmentsPerLogFile; if (seg_diff > seg) { log_diff++; seg = MaxSegmentsPerLogFile - (seg_diff - seg); } else seg -= seg_diff; if (log >= log_diff) { log -= log_diff; cleanup = true; } else { log = 0; seg = 0; } } } XLogFileName(exclusiveCleanupFileName, tli, log, seg); return cleanup; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ //! Erode the image by a square structuring element of specified size \newinstance. CImg<T> get_erode(const unsigned int s) const { return (+*this).erode(s);] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void cirrus_bitblt_rop_nop(CirrusVGAState *s, uint32_t dstaddr, const uint8_t *src, int dstpitch,int srcpitch, int bltwidth,int bltheight) { }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int jpc_ppm_getparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in) { jpc_ppm_t *ppm = &ms->parms.ppm; /* Eliminate compiler warning about unused variables. */ cstate = 0; ppm->data = 0; if (ms->len < 1) { goto error; } if (jpc_getuint8(in, &ppm->ind)) { goto error; } ppm->len = ms->len - 1; if (ppm->len > 0) { if (!(ppm->data = jas_malloc(ppm->len))) { goto error; } if (JAS_CAST(jas_uint, jas_stream_read(in, ppm->data, ppm->len)) != ppm->len) { goto error; } } else { ppm->data = 0; } return 0; error: jpc_ppm_destroyparms(ms); return -1; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [TEST_P(ProxyProtocolTest, V2Fragmented3Error) { // A well-formed ipv4/tcp header, delivering all of the signature +1, w/ an error // simulated in recv() on the +1 constexpr uint8_t buffer[] = {0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55, 0x49, 0x54, 0x0a, 0x21, 0x11, 0x00, 0x0c, 0x01, 0x02, 0x03, 0x04, 0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x00, 0x02, 'm', 'o', 'r', 'e', ' ', 'd', 'a', 't', 'a'}; Api::MockOsSysCalls os_sys_calls; TestThreadsafeSingletonInjector<Api::OsSysCallsImpl> os_calls(&os_sys_calls); EXPECT_CALL(os_sys_calls, recv(_, _, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([this](os_fd_t fd, void* buf, size_t len, int flags) { return os_sys_calls_actual_.recv(fd, buf, len, flags); })); EXPECT_CALL(os_sys_calls, recv(_, _, 1, _)) .Times(AnyNumber()) .WillOnce(Return(Api::SysCallSizeResult{-1, 0})); EXPECT_CALL(os_sys_calls, connect(_, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([this](os_fd_t sockfd, const sockaddr* addr, socklen_t addrlen) { return os_sys_calls_actual_.connect(sockfd, addr, addrlen); })); EXPECT_CALL(os_sys_calls, ioctl(_, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([this](os_fd_t fd, unsigned long int request, void* argp) { return os_sys_calls_actual_.ioctl(fd, request, argp); })); EXPECT_CALL(os_sys_calls, writev(_, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([this](os_fd_t fd, const iovec* iov, int iovcnt) { return os_sys_calls_actual_.writev(fd, iov, iovcnt); })); EXPECT_CALL(os_sys_calls, readv(_, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke([this](os_fd_t fd, const iovec* iov, int iovcnt) { return os_sys_calls_actual_.readv(fd, iov, iovcnt); })); EXPECT_CALL(os_sys_calls, getsockopt_(_, _, _, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke( [this](os_fd_t sockfd, int level, int optname, void* optval, socklen_t* optlen) -> int { return os_sys_calls_actual_.getsockopt(sockfd, level, optname, optval, optlen).rc_; })); EXPECT_CALL(os_sys_calls, getsockname(_, _, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke( [this](os_fd_t sockfd, sockaddr* name, socklen_t* namelen) -> Api::SysCallIntResult { return os_sys_calls_actual_.getsockname(sockfd, name, namelen); })); EXPECT_CALL(os_sys_calls, shutdown(_, _)) .Times(AnyNumber()) .WillRepeatedly(Invoke( [this](os_fd_t sockfd, int how) { return os_sys_calls_actual_.shutdown(sockfd, how); })); EXPECT_CALL(os_sys_calls, close(_)).Times(AnyNumber()).WillRepeatedly(Invoke([this](os_fd_t fd) { return os_sys_calls_actual_.close(fd); })); connect(false); write(buffer, 17); expectProxyProtoError(); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [*/ static int send_client_reply_packet(MCPVIO_EXT *mpvio, const uchar *data, int data_len) { MYSQL *mysql= mpvio->mysql; NET *net= &mysql->net; char *buff, *end; size_t buff_size; size_t connect_attrs_len= (mysql->server_capabilities & CLIENT_CONNECT_ATTRS && mysql->options.extension) ? mysql->options.extension->connection_attributes_length : 0; DBUG_ASSERT(connect_attrs_len < MAX_CONNECTION_ATTR_STORAGE_LENGTH); /* see end= buff+32 below, fixed size of the packet is 32 bytes. +9 because data is a length encoded binary where meta data size is max 9. */ buff_size= 33 + USERNAME_LENGTH + data_len + 9 + NAME_LEN + NAME_LEN + connect_attrs_len + 9; buff= my_alloca(buff_size); mysql->client_flag|= mysql->options.client_flag; mysql->client_flag|= CLIENT_CAPABILITIES; if (mysql->client_flag & CLIENT_MULTI_STATEMENTS) mysql->client_flag|= CLIENT_MULTI_RESULTS; #if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY) if (mysql->options.ssl_key || mysql->options.ssl_cert || mysql->options.ssl_ca || mysql->options.ssl_capath || mysql->options.ssl_cipher || (mysql->options.extension && mysql->options.extension->ssl_crl) || (mysql->options.extension && mysql->options.extension->ssl_crlpath)) mysql->options.use_ssl= 1; if (mysql->options.use_ssl) mysql->client_flag|= CLIENT_SSL; #endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/ if (mpvio->db) mysql->client_flag|= CLIENT_CONNECT_WITH_DB; else mysql->client_flag&= ~CLIENT_CONNECT_WITH_DB; /* Remove options that server doesn't support */ mysql->client_flag= mysql->client_flag & (~(CLIENT_COMPRESS | CLIENT_SSL | CLIENT_PROTOCOL_41) | mysql->server_capabilities); #ifndef HAVE_COMPRESS mysql->client_flag&= ~CLIENT_COMPRESS; #endif if (mysql->client_flag & CLIENT_PROTOCOL_41) { /* 4.1 server and 4.1 client has a 32 byte option flag */ int4store(buff,mysql->client_flag); int4store(buff+4, net->max_packet_size); buff[8]= (char) mysql->charset->number; memset(buff+9, 0, 32-9); end= buff+32; } else { int2store(buff, mysql->client_flag); int3store(buff+2, net->max_packet_size); end= buff+5; } #ifdef HAVE_OPENSSL if (mysql->client_flag & CLIENT_SSL) { /* Do the SSL layering. */ struct st_mysql_options *options= &mysql->options; struct st_VioSSLFd *ssl_fd; enum enum_ssl_init_error ssl_init_error; const char *cert_error; unsigned long ssl_error; /* Send mysql->client_flag, max_packet_size - unencrypted otherwise the server does not know we want to do SSL */ if (my_net_write(net, (uchar*)buff, (size_t) (end-buff)) || net_flush(net)) { set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, ER(CR_SERVER_LOST_EXTENDED), "sending connection information to server", errno); goto error; } /* Create the VioSSLConnectorFd - init SSL and load certs */ if (!(ssl_fd= new_VioSSLConnectorFd(options->ssl_key, options->ssl_cert, options->ssl_ca, options->ssl_capath, options->ssl_cipher, &ssl_init_error, options->extension ? options->extension->ssl_crl : NULL, options->extension ? options->extension->ssl_crlpath : NULL))) { set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate, ER(CR_SSL_CONNECTION_ERROR), sslGetErrString(ssl_init_error)); goto error; } mysql->connector_fd= (unsigned char *) ssl_fd; /* Connect to the server */ DBUG_PRINT("info", ("IO layer change in progress...")); if (sslconnect(ssl_fd, net->vio, (long) (mysql->options.connect_timeout), &ssl_error)) { char buf[512]; ERR_error_string_n(ssl_error, buf, 512); buf[511]= 0; set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate, ER(CR_SSL_CONNECTION_ERROR), buf); goto error; } DBUG_PRINT("info", ("IO layer change done!")); /* Verify server cert */ if ((mysql->client_flag & CLIENT_SSL_VERIFY_SERVER_CERT) && ssl_verify_server_cert(net->vio, mysql->host, &cert_error)) { set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate, ER(CR_SSL_CONNECTION_ERROR), cert_error); goto error; } } #endif /* HAVE_OPENSSL */ DBUG_PRINT("info",("Server version = '%s' capabilites: %lu status: %u client_flag: %lu", mysql->server_version, mysql->server_capabilities, mysql->server_status, mysql->client_flag)); compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH); /* This needs to be changed as it's not useful with big packets */ if (mysql->user[0]) strmake(end, mysql->user, USERNAME_LENGTH); else read_user_name(end); /* We have to handle different version of handshake here */ DBUG_PRINT("info",("user: %s",end)); end= strend(end) + 1; if (data_len) { if (mysql->server_capabilities & CLIENT_SECURE_CONNECTION) { /* Since the older versions of server do not have CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA capability, a check is performed on this before sending auth data. If lenenc support is not available, the data is sent in the format of first byte representing the length of the string followed by the actual string. */ if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA) end= write_length_encoded_string4(end, (char *)(buff + buff_size), (char *) data, (char *)(data + data_len)); else end= write_string(end, (char *)(buff + buff_size), (char *) data, (char *)(data + data_len)); if (end == NULL) goto error; } else { DBUG_ASSERT(data_len == SCRAMBLE_LENGTH_323 + 1); /* incl. \0 at the end */ memcpy(end, data, data_len); end+= data_len; } } else *end++= 0; /* Add database if needed */ if (mpvio->db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB)) { end= strmake(end, mpvio->db, NAME_LEN) + 1; mysql->db= my_strdup(mpvio->db, MYF(MY_WME)); } if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH) end= strmake(end, mpvio->plugin->name, NAME_LEN) + 1; end= (char *) send_client_connect_attrs(mysql, (uchar *) end); /* Write authentication package */ if (my_net_write(net, (uchar*) buff, (size_t) (end-buff)) || net_flush(net)) { set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate, ER(CR_SERVER_LOST_EXTENDED), "sending authentication information", errno); goto error; } my_afree(buff); return 0; error: my_afree(buff); return 1;] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void cil_print_recursive_blockinherit(struct cil_tree_node *bi_node, struct cil_tree_node *terminating_node) { struct cil_list *trace = NULL; struct cil_list_item *item = NULL; struct cil_tree_node *curr = NULL; cil_list_init(&trace, CIL_NODE); for (curr = bi_node; curr != terminating_node; curr = curr->parent) { if (curr->flavor == CIL_BLOCK) { cil_list_prepend(trace, CIL_NODE, curr); } else if (curr->flavor == CIL_BLOCKINHERIT) { if (curr != bi_node) { cil_list_prepend(trace, CIL_NODE, NODE(((struct cil_blockinherit *)curr->data)->block)); } cil_list_prepend(trace, CIL_NODE, curr); } else { cil_list_prepend(trace, CIL_NODE, curr); } } cil_list_prepend(trace, CIL_NODE, terminating_node); cil_list_for_each(item, trace) { curr = item->data; if (curr->flavor == CIL_BLOCK) { cil_tree_log(curr, CIL_ERR, "block %s", DATUM(curr->data)->name); } else if (curr->flavor == CIL_BLOCKINHERIT) { cil_tree_log(curr, CIL_ERR, "blockinherit %s", ((struct cil_blockinherit *)curr->data)->block_str); } else if (curr->flavor == CIL_OPTIONAL) { cil_tree_log(curr, CIL_ERR, "optional %s", DATUM(curr->data)->name); } else { cil_tree_log(curr, CIL_ERR, "%s", cil_node_to_string(curr)); } } cil_list_destroy(&trace, CIL_FALSE); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static inline __u32 inotify_arg_to_mask(u32 arg) { __u32 mask; /* * everything should accept their own ignored, cares about children, * and should receive events when the inode is unmounted */ mask = (FS_IN_IGNORED | FS_EVENT_ON_CHILD | FS_UNMOUNT); /* mask off the flags used to open the fd */ mask |= (arg & (IN_ALL_EVENTS | IN_ONESHOT | IN_EXCL_UNLINK)); return mask; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [png_write_PLTE(png_structrp png_ptr, png_const_colorp palette, png_uint_32 num_pal) { png_uint_32 i; png_const_colorp pal_ptr; png_byte buf[3]; png_debug(1, "in png_write_PLTE"); if (( #ifdef PNG_MNG_FEATURES_SUPPORTED (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 && #endif num_pal == 0) || num_pal > 256) { if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { png_error(png_ptr, "Invalid number of colors in palette"); } else { png_warning(png_ptr, "Invalid number of colors in palette"); return; } } if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) { png_warning(png_ptr, "Ignoring request to write a PLTE chunk in grayscale PNG"); return; } png_ptr->num_palette = (png_uint_16)num_pal; png_debug1(3, "num_palette = %d", png_ptr->num_palette); png_write_chunk_header(png_ptr, png_PLTE, (png_uint_32)(num_pal * 3)); #ifdef PNG_POINTER_INDEXING_SUPPORTED for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) { buf[0] = pal_ptr->red; buf[1] = pal_ptr->green; buf[2] = pal_ptr->blue; png_write_chunk_data(png_ptr, buf, (png_size_t)3); } #else /* This is a little slower but some buggy compilers need to do this * instead */ pal_ptr=palette; for (i = 0; i < num_pal; i++) { buf[0] = pal_ptr[i].red; buf[1] = pal_ptr[i].green; buf[2] = pal_ptr[i].blue; png_write_chunk_data(png_ptr, buf, (png_size_t)3); } #endif png_write_chunk_end(png_ptr); png_ptr->mode |= PNG_HAVE_PLTE; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int rtecp_logout(sc_card_t *card) { sc_apdu_t apdu; int r; assert(card && card->ctx); sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x40, 0, 0); apdu.cla = 0x80; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void rundebug() { }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void CLASS bad_pixels (const char *cfname) { FILE *fp=NULL; #ifndef LIBRAW_LIBRARY_BUILD char *fname, *cp, line[128]; int len, time, row, col, r, c, rad, tot, n, fixed=0; #else char *cp, line[128]; int time, row, col, r, c, rad, tot, n; #ifdef DCRAW_VERBOSE int fixed = 0; #endif #endif if (!filters) return; #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_BAD_PIXELS,0,2); #endif if (cfname) fp = fopen (cfname, "r"); #line 4151 "dcraw/dcraw.c" if (!fp) { #ifdef LIBRAW_LIBRARY_BUILD imgdata.process_warnings |= LIBRAW_WARN_NO_BADPIXELMAP; #endif return; } while (fgets (line, 128, fp)) { cp = strchr (line, '#'); if (cp) *cp = 0; if (sscanf (line, "%d %d %d", &col, &row, &time) != 3) continue; if ((unsigned) col >= width || (unsigned) row >= height) continue; if (time > timestamp) continue; for (tot=n=0, rad=1; rad < 3 && n==0; rad++) for (r = row-rad; r <= row+rad; r++) for (c = col-rad; c <= col+rad; c++) if ((unsigned) r < height && (unsigned) c < width && (r != row || c != col) && fcol(r,c) == fcol(row,col)) { tot += BAYER2(r,c); n++; } BAYER2(row,col) = tot/n; #ifdef DCRAW_VERBOSE if (verbose) { if (!fixed++) fprintf (stderr,_("Fixed dead pixels at:")); fprintf (stderr, " %d,%d", col, row); } #endif } #ifdef DCRAW_VERBOSE if (fixed) fputc ('\n', stderr); #endif fclose (fp); #ifdef LIBRAW_LIBRARY_BUILD RUN_CALLBACK(LIBRAW_PROGRESS_BAD_PIXELS,1,2); #endif }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static inline uint32_t _ring_fwd_done(pmixp_coll_ring_ctx_t *coll_ctx) { return !(coll_ctx->coll->peers_cnt - coll_ctx->forward_cnt - 1); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void Transform::interpolate_nearestneighbour( RawTile& in, unsigned int resampled_width, unsigned int resampled_height ){ // Pointer to input buffer unsigned char *input = (unsigned char*) in.data; int channels = in.channels; unsigned int width = in.width; unsigned int height = in.height; // Pointer to output buffer unsigned char *output; // Create new buffer if size is larger than input size bool new_buffer = false; if( resampled_width*resampled_height > in.width*in.height ){ new_buffer = true; output = new unsigned char[(unsigned long long)resampled_width*resampled_height*in.channels]; } else output = (unsigned char*) in.data; // Calculate our scale float xscale = (float)width / (float)resampled_width; float yscale = (float)height / (float)resampled_height; for( unsigned int j=0; j<resampled_height; j++ ){ for( unsigned int i=0; i<resampled_width; i++ ){ // Indexes in the current pyramid resolution and resampled spaces // Make sure to limit our input index to the image surface unsigned long ii = (unsigned int) floorf(i*xscale); unsigned long jj = (unsigned int) floorf(j*yscale); unsigned long pyramid_index = (unsigned int) channels * ( ii + jj*width ); unsigned long long resampled_index = (unsigned long long)(i + j*resampled_width)*channels; for( int k=0; k<in.channels; k++ ){ output[resampled_index+k] = input[pyramid_index+k]; } } } // Delete original buffer if( new_buffer ) delete[] (unsigned char*) input; // Correctly set our Rawtile info in.width = resampled_width; in.height = resampled_height; in.dataLength = resampled_width * resampled_height * channels * (in.bpc/8); in.data = output; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [run_client_script_err_backup( gpointer data, gpointer user_data) { char *line = data; script_output_t *so = user_data; if (line && so->stream) { g_fprintf(so->stream, "? %s\n", line); } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void exit_thread(void) { discard_lazy_cpu_state(); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [SYSCALL_DEFINE2(old_getrlimit, unsigned int, resource, struct rlimit __user *, rlim) { struct rlimit x; if (resource >= RLIM_NLIMITS) return -EINVAL; task_lock(current->group_leader); x = current->signal->rlim[resource]; task_unlock(current->group_leader); if (x.rlim_cur > 0x7FFFFFFF) x.rlim_cur = 0x7FFFFFFF; if (x.rlim_max > 0x7FFFFFFF) x.rlim_max = 0x7FFFFFFF; return copy_to_user(rlim, &x, sizeof(x))?-EFAULT:0; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ absl::string_view pathAndQueryParams() const { return path_and_query_params_; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [PHP_FUNCTION(imagefill) { zval *IM; long x, y, col; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlll", &IM, &x, &y, &col) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); gdImageFill(im, x, y, col); RETURN_TRUE; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { char *s, *t; size_t l; if (!in || !out || !(in->data)) { return -1; } out->data = (uint8_t *)ldb_casefold(ldb, mem_ctx, (const char *)(in->data), in->length); if (out->data == NULL) { ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_handler_fold: unable to casefold string [%.*s]", (int)in->length, (const char *)in->data); return -1; } s = (char *)(out->data); /* remove trailing spaces if any */ l = strlen(s); while (l > 0 && s[l - 1] == ' ') l--; s[l] = '\0'; /* remove leading spaces if any */ if (*s == ' ') { for (t = s; *s == ' '; s++) ; /* remove leading spaces by moving down the string */ memmove(t, s, l); s = t; } /* check middle spaces */ while ((t = strchr(s, ' ')) != NULL) { for (s = t; *s == ' '; s++) ; if ((s - t) > 1) { l = strlen(s); /* remove all spaces but one by moving down the string */ memmove(t + 1, s, l); } } out->length = strlen((char *)out->data); return 0; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [TEST_F(RouterTest, AppendCluster1) { testAppendCluster(absl::make_optional(Http::LowerCaseString("x-custom-cluster"))); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int RGWListBucket::parse_max_keys() { // Bound max value of max-keys to configured value for security // Bound min value of max-keys to '0' // Some S3 clients explicitly send max-keys=0 to detect if the bucket is // empty without listing any items. op_ret = parse_value_and_bound(max_keys, &max, 0, g_conf()->rgw_max_listing_results, default_max); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ static void __netdev_adjacent_dev_unlink(struct net_device *dev, struct net_device *upper_dev) { __netdev_adjacent_dev_unlink_lists(dev, upper_dev, &dev->all_adj_list.upper, &upper_dev->all_adj_list.lower);] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ std::uint32_t calculate_segment_size(std::uint32_t size) override { return size; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) { if (!alg) return 0; if (ptype != V_ASN1_UNDEF) { if (alg->parameter == NULL) alg->parameter = ASN1_TYPE_new(); if (alg->parameter == NULL) return 0; } if (alg) { if (alg->algorithm) ASN1_OBJECT_free(alg->algorithm); alg->algorithm = aobj; } if (ptype == 0) return 1; if (ptype == V_ASN1_UNDEF) { if (alg->parameter) { ASN1_TYPE_free(alg->parameter); alg->parameter = NULL; } } else ASN1_TYPE_set(alg->parameter, ptype, pval); return 1; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int sqfs_size(const char *filename, loff_t *size) { struct squashfs_super_block *sblk = ctxt.sblk; struct squashfs_symlink_inode *symlink; struct fs_dir_stream *dirsp = NULL; struct squashfs_base_inode *base; struct squashfs_dir_stream *dirs; struct squashfs_lreg_inode *lreg; struct squashfs_reg_inode *reg; char *dir, *file, *resolved; struct fs_dirent *dent; unsigned char *ipos; int ret, i_number; sqfs_split_path(&file, &dir, filename); /* * sqfs_opendir will uncompress inode and directory tables, and will * return a pointer to the directory that contains the requested file. */ ret = sqfs_opendir(dir, &dirsp); if (ret) { ret = -EINVAL; goto free_strings; } dirs = (struct squashfs_dir_stream *)dirsp; while (!sqfs_readdir(dirsp, &dent)) { ret = strcmp(dent->name, file); if (!ret) break; free(dirs->entry); dirs->entry = NULL; } if (ret) { printf("File not found.\n"); *size = 0; ret = -EINVAL; goto free_strings; } i_number = dirs->dir_header->inode_number + dirs->entry->inode_offset; ipos = sqfs_find_inode(dirs->inode_table, i_number, sblk->inodes, sblk->block_size); free(dirs->entry); dirs->entry = NULL; base = (struct squashfs_base_inode *)ipos; switch (get_unaligned_le16(&base->inode_type)) { case SQFS_REG_TYPE: reg = (struct squashfs_reg_inode *)ipos; *size = get_unaligned_le32(&reg->file_size); break; case SQFS_LREG_TYPE: lreg = (struct squashfs_lreg_inode *)ipos; *size = get_unaligned_le64(&lreg->file_size); break; case SQFS_SYMLINK_TYPE: case SQFS_LSYMLINK_TYPE: symlink = (struct squashfs_symlink_inode *)ipos; resolved = sqfs_resolve_symlink(symlink, filename); ret = sqfs_size(resolved, size); free(resolved); break; case SQFS_BLKDEV_TYPE: case SQFS_CHRDEV_TYPE: case SQFS_LBLKDEV_TYPE: case SQFS_LCHRDEV_TYPE: case SQFS_FIFO_TYPE: case SQFS_SOCKET_TYPE: case SQFS_LFIFO_TYPE: case SQFS_LSOCKET_TYPE: default: printf("Unable to recover entry's size.\n"); *size = 0; ret = -EINVAL; break; } free_strings: free(dir); free(file); sqfs_closedir(dirsp); return ret; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [rfbTightExtensionClientClose(rfbClientPtr cl, void* data) { if(data != NULL) free(data); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [_PUBLIC_ enum ndr_err_code ndr_pull_dns_txt_record(struct ndr_pull *ndr, int ndr_flags, struct dns_txt_record *r) { NDR_PULL_CHECK_FLAGS(ndr, ndr_flags); if (ndr_flags & NDR_SCALARS) { enum ndr_err_code ndr_err; uint32_t data_size = ndr->data_size; uint32_t record_size = 0; ndr_err = ndr_token_retrieve(&ndr->array_size_list, r, &record_size); if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NDR_PULL_NEED_BYTES(ndr, record_size); ndr->data_size = ndr->offset + record_size; } NDR_CHECK(ndr_pull_align(ndr, 1)); NDR_CHECK(ndr_pull_dnsp_string_list(ndr, NDR_SCALARS, &r->txt)); NDR_CHECK(ndr_pull_trailer_align(ndr, 1)); ndr->data_size = data_size; } if (ndr_flags & NDR_BUFFERS) { } return NDR_ERR_SUCCESS; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void vmx_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 ar; if (vmx->rmode.vm86_active && seg != VCPU_SREG_LDTR) { *var = vmx->rmode.segs[seg]; if (seg == VCPU_SREG_TR || var->selector == vmx_read_guest_seg_selector(vmx, seg)) return; var->base = vmx_read_guest_seg_base(vmx, seg); var->selector = vmx_read_guest_seg_selector(vmx, seg); return; } var->base = vmx_read_guest_seg_base(vmx, seg); var->limit = vmx_read_guest_seg_limit(vmx, seg); var->selector = vmx_read_guest_seg_selector(vmx, seg); ar = vmx_read_guest_seg_ar(vmx, seg); var->unusable = (ar >> 16) & 1; var->type = ar & 15; var->s = (ar >> 4) & 1; var->dpl = (ar >> 5) & 3; /* * Some userspaces do not preserve unusable property. Since usable * segment has to be present according to VMX spec we can use present * property to amend userspace bug by making unusable segment always * nonpresent. vmx_segment_access_rights() already marks nonpresent * segment as unusable. */ var->present = !var->unusable; var->avl = (ar >> 12) & 1; var->l = (ar >> 13) & 1; var->db = (ar >> 14) & 1; var->g = (ar >> 15) & 1; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [cookedprint( int datatype, int length, const char *data, int status, int quiet, FILE *fp ) { char *name; char *value; char output_raw; int fmt; l_fp lfp; sockaddr_u hval; u_long uval; int narr; size_t len; l_fp lfparr[8]; char b[12]; char bn[2 * MAXVARLEN]; char bv[2 * MAXVALLEN]; UNUSED_ARG(datatype); if (!quiet) fprintf(fp, "status=%04x %s,\n", status, statustoa(datatype, status)); startoutput(); while (nextvar(&length, &data, &name, &value)) { fmt = varfmt(name); output_raw = 0; switch (fmt) { case PADDING: output_raw = '*'; break; case TS: if (!decodets(value, &lfp)) output_raw = '?'; else output(fp, name, prettydate(&lfp)); break; case HA: /* fallthru */ case NA: if (!decodenetnum(value, &hval)) { output_raw = '?'; } else if (fmt == HA){ output(fp, name, nntohost(&hval)); } else { output(fp, name, stoa(&hval)); } break; case RF: if (decodenetnum(value, &hval)) { if (ISREFCLOCKADR(&hval)) output(fp, name, refnumtoa(&hval)); else output(fp, name, stoa(&hval)); } else if (strlen(value) <= 4) { output(fp, name, value); } else { output_raw = '?'; } break; case LP: if (!decodeuint(value, &uval) || uval > 3) { output_raw = '?'; } else { b[0] = (0x2 & uval) ? '1' : '0'; b[1] = (0x1 & uval) ? '1' : '0'; b[2] = '\0'; output(fp, name, b); } break; case OC: if (!decodeuint(value, &uval)) { output_raw = '?'; } else { snprintf(b, sizeof(b), "%03lo", uval); output(fp, name, b); } break; case AR: if (!decodearr(value, &narr, lfparr)) output_raw = '?'; else outputarr(fp, name, narr, lfparr); break; case FX: if (!decodeuint(value, &uval)) output_raw = '?'; else output(fp, name, tstflags(uval)); break; default: fprintf(stderr, "Internal error in cookedprint, %s=%s, fmt %d\n", name, value, fmt); output_raw = '?'; break; } if (output_raw != 0) { atoascii(name, MAXVARLEN, bn, sizeof(bn)); atoascii(value, MAXVALLEN, bv, sizeof(bv)); if (output_raw != '*') { len = strlen(bv); bv[len] = output_raw; bv[len+1] = '\0'; } output(fp, bn, bv); } } endoutput(fp); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static Image *ReadICONImage(const ImageInfo *image_info, ExceptionInfo *exception) { IconFile icon_file; IconInfo icon_info; Image *image; MagickBooleanType status; register ssize_t i, x; register Quantum *q; register unsigned char *p; size_t bit, byte, bytes_per_line, one, scanline_pad; ssize_t count, offset, y; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); (void) LogMagickEvent(CoderEvent,GetMagickModule(),"%s",image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } icon_file.reserved=(short) ReadBlobLSBShort(image); icon_file.resource_type=(short) ReadBlobLSBShort(image); icon_file.count=(short) ReadBlobLSBShort(image); if ((icon_file.reserved != 0) || ((icon_file.resource_type != 1) && (icon_file.resource_type != 2)) || (icon_file.count > MaxIcons)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); for (i=0; i < icon_file.count; i++) { icon_file.directory[i].width=(unsigned char) ReadBlobByte(image); icon_file.directory[i].height=(unsigned char) ReadBlobByte(image); icon_file.directory[i].colors=(unsigned char) ReadBlobByte(image); icon_file.directory[i].reserved=(unsigned char) ReadBlobByte(image); icon_file.directory[i].planes=(unsigned short) ReadBlobLSBShort(image); icon_file.directory[i].bits_per_pixel=(unsigned short) ReadBlobLSBShort(image); icon_file.directory[i].size=ReadBlobLSBLong(image); icon_file.directory[i].offset=ReadBlobLSBLong(image); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } } one=1; for (i=0; i < icon_file.count; i++) { /* Verify Icon identifier. */ offset=(ssize_t) SeekBlob(image,(MagickOffsetType) icon_file.directory[i].offset,SEEK_SET); if (offset < 0) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); icon_info.size=ReadBlobLSBLong(image); icon_info.width=(unsigned char) ((int) ReadBlobLSBLong(image)); icon_info.height=(unsigned char) ((int) ReadBlobLSBLong(image)/2); icon_info.planes=ReadBlobLSBShort(image); icon_info.bits_per_pixel=ReadBlobLSBShort(image); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile", image->filename); break; } if (((icon_info.planes == 18505) && (icon_info.bits_per_pixel == 21060)) || (icon_info.size == 0x474e5089)) { Image *icon_image; ImageInfo *read_info; size_t length; unsigned char *png; /* Icon image encoded as a compressed PNG image. */ length=icon_file.directory[i].size; png=(unsigned char *) AcquireQuantumMemory(length+16,sizeof(*png)); if (png == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) CopyMagickMemory(png,"\211PNG\r\n\032\n\000\000\000\015",12); png[12]=(unsigned char) icon_info.planes; png[13]=(unsigned char) (icon_info.planes >> 8); png[14]=(unsigned char) icon_info.bits_per_pixel; png[15]=(unsigned char) (icon_info.bits_per_pixel >> 8); count=ReadBlob(image,length-16,png+16); icon_image=(Image *) NULL; if (count > 0) { read_info=CloneImageInfo(image_info); (void) CopyMagickString(read_info->magick,"PNG",MagickPathExtent); icon_image=BlobToImage(read_info,png,length+16,exception); read_info=DestroyImageInfo(read_info); } png=(unsigned char *) RelinquishMagickMemory(png); if (icon_image == (Image *) NULL) { if (count != (ssize_t) (length-16)) ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); image=DestroyImageList(image); return((Image *) NULL); } DestroyBlob(icon_image); icon_image->blob=ReferenceBlob(image->blob); ReplaceImageInList(&image,icon_image); } else { if (icon_info.bits_per_pixel > 32) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); icon_info.compression=ReadBlobLSBLong(image); icon_info.image_size=ReadBlobLSBLong(image); icon_info.x_pixels=ReadBlobLSBLong(image); icon_info.y_pixels=ReadBlobLSBLong(image); icon_info.number_colors=ReadBlobLSBLong(image); icon_info.colors_important=ReadBlobLSBLong(image); image->alpha_trait=BlendPixelTrait; image->columns=(size_t) icon_file.directory[i].width; if ((ssize_t) image->columns > icon_info.width) image->columns=(size_t) icon_info.width; if (image->columns == 0) image->columns=256; image->rows=(size_t) icon_file.directory[i].height; if ((ssize_t) image->rows > icon_info.height) image->rows=(size_t) icon_info.height; if (image->rows == 0) image->rows=256; image->depth=icon_info.bits_per_pixel; if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), " scene = %.20g",(double) i); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " size = %.20g",(double) icon_info.size); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " width = %.20g",(double) icon_file.directory[i].width); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " height = %.20g",(double) icon_file.directory[i].height); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " colors = %.20g",(double ) icon_info.number_colors); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " planes = %.20g",(double) icon_info.planes); (void) LogMagickEvent(CoderEvent,GetMagickModule(), " bpp = %.20g",(double) icon_info.bits_per_pixel); } if ((icon_info.number_colors != 0) || (icon_info.bits_per_pixel <= 16U)) { image->storage_class=PseudoClass; image->colors=icon_info.number_colors; if (image->colors == 0) image->colors=one << icon_info.bits_per_pixel; } if (image->storage_class == PseudoClass) { register ssize_t i; unsigned char *icon_colormap; /* Read Icon raster colormap. */ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); icon_colormap=(unsigned char *) AcquireQuantumMemory((size_t) image->colors,4UL*sizeof(*icon_colormap)); if (icon_colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); count=ReadBlob(image,(size_t) (4*image->colors),icon_colormap); if (count != (ssize_t) (4*image->colors)) ThrowReaderException(CorruptImageError, "InsufficientImageDataInFile"); p=icon_colormap; for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].blue=(Quantum) ScaleCharToQuantum(*p++); image->colormap[i].green=(Quantum) ScaleCharToQuantum(*p++); image->colormap[i].red=(Quantum) ScaleCharToQuantum(*p++); p++; } icon_colormap=(unsigned char *) RelinquishMagickMemory(icon_colormap); } /* Convert Icon raster image to pixel packets. */ if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); bytes_per_line=(((image->columns*icon_info.bits_per_pixel)+31) & ~31) >> 3; (void) bytes_per_line; scanline_pad=((((image->columns*icon_info.bits_per_pixel)+31) & ~31)- (image->columns*icon_info.bits_per_pixel)) >> 3; switch (icon_info.bits_per_pixel) { case 1: { /* Convert bitmap scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) (image->columns-7); x+=8) { byte=(size_t) ReadBlobByte(image); for (bit=0; bit < 8; bit++) { SetPixelIndex(image,((byte & (0x80 >> bit)) != 0 ? 0x01 : 0x00),q); q+=GetPixelChannels(image); } } if ((image->columns % 8) != 0) { byte=(size_t) ReadBlobByte(image); for (bit=0; bit < (image->columns % 8); bit++) { SetPixelIndex(image,((byte & (0x80 >> bit)) != 0 ? 0x01 : 0x00),q); q+=GetPixelChannels(image); } } for (x=0; x < (ssize_t) scanline_pad; x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,image->rows-y-1, image->rows); if (status == MagickFalse) break; } } break; } case 4: { /* Read 4-bit Icon scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-1); x+=2) { byte=(size_t) ReadBlobByte(image); SetPixelIndex(image,((byte >> 4) & 0xf),q); q+=GetPixelChannels(image); SetPixelIndex(image,((byte) & 0xf),q); q+=GetPixelChannels(image); } if ((image->columns % 2) != 0) { byte=(size_t) ReadBlobByte(image); SetPixelIndex(image,((byte >> 4) & 0xf),q); q+=GetPixelChannels(image); } for (x=0; x < (ssize_t) scanline_pad; x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,image->rows-y-1, image->rows); if (status == MagickFalse) break; } } break; } case 8: { /* Convert PseudoColor scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { byte=(size_t) ReadBlobByte(image); SetPixelIndex(image,byte,q); q+=GetPixelChannels(image); } for (x=0; x < (ssize_t) scanline_pad; x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,image->rows-y-1, image->rows); if (status == MagickFalse) break; } } break; } case 16: { /* Convert PseudoColor scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { byte=(size_t) ReadBlobByte(image); byte|=(size_t) (ReadBlobByte(image) << 8); SetPixelIndex(image,byte,q); q+=GetPixelChannels(image); } for (x=0; x < (ssize_t) scanline_pad; x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,image->rows-y-1, image->rows); if (status == MagickFalse) break; } } break; } case 24: case 32: { /* Convert DirectColor scanline. */ for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelBlue(image,ScaleCharToQuantum((unsigned char) ReadBlobByte(image)),q); SetPixelGreen(image,ScaleCharToQuantum((unsigned char) ReadBlobByte(image)),q); SetPixelRed(image,ScaleCharToQuantum((unsigned char) ReadBlobByte(image)),q); if (icon_info.bits_per_pixel == 32) SetPixelAlpha(image,ScaleCharToQuantum((unsigned char) ReadBlobByte(image)),q); q+=GetPixelChannels(image); } if (icon_info.bits_per_pixel == 24) for (x=0; x < (ssize_t) scanline_pad; x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,image->rows-y-1, image->rows); if (status == MagickFalse) break; } } break; } default: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); } if (image_info->ping == MagickFalse) (void) SyncImage(image,exception); if (icon_info.bits_per_pixel != 32) { /* Read the ICON alpha mask. */ image->storage_class=DirectClass; for (y=(ssize_t) image->rows-1; y >= 0; y--) { q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < ((ssize_t) image->columns-7); x+=8) { byte=(size_t) ReadBlobByte(image); for (bit=0; bit < 8; bit++) { SetPixelAlpha(image,(((byte & (0x80 >> bit)) != 0) ? TransparentAlpha : OpaqueAlpha),q); q+=GetPixelChannels(image); } } if ((image->columns % 8) != 0) { byte=(size_t) ReadBlobByte(image); for (bit=0; bit < (image->columns % 8); bit++) { SetPixelAlpha(image,(((byte & (0x80 >> bit)) != 0) ? TransparentAlpha : OpaqueAlpha),q); q+=GetPixelChannels(image); } } if ((image->columns % 32) != 0) for (x=0; x < (ssize_t) ((32-(image->columns % 32))/8); x++) (void) ReadBlobByte(image); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError, "UnexpectedEndOfFile",image->filename); break; } } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if (i < (ssize_t) (icon_file.count-1)) { /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } (void) CloseBlob(image); return(GetFirstImageInList(image)); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int packet_release(struct socket *sock) { struct sock *sk = sock->sk; struct packet_sock *po; struct net *net; union tpacket_req_u req_u; if (!sk) return 0; net = sock_net(sk); po = pkt_sk(sk); mutex_lock(&net->packet.sklist_lock); sk_del_node_init_rcu(sk); mutex_unlock(&net->packet.sklist_lock); preempt_disable(); sock_prot_inuse_add(net, sk->sk_prot, -1); preempt_enable(); spin_lock(&po->bind_lock); unregister_prot_hook(sk, false); packet_cached_dev_reset(po); if (po->prot_hook.dev) { dev_put(po->prot_hook.dev); po->prot_hook.dev = NULL; } spin_unlock(&po->bind_lock); packet_flush_mclist(sk); if (po->rx_ring.pg_vec) { memset(&req_u, 0, sizeof(req_u)); packet_set_ring(sk, &req_u, 1, 0); } if (po->tx_ring.pg_vec) { memset(&req_u, 0, sizeof(req_u)); packet_set_ring(sk, &req_u, 1, 1); } fanout_release(sk); synchronize_net(); /* * Now the socket is dead. No more input will appear. */ sock_orphan(sk); sock->sk = NULL; /* Purge queues */ skb_queue_purge(&sk->sk_receive_queue); packet_free_pending(po); sk_refcnt_debug_release(sk); sock_put(sk); return 0; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static u32 apic_get_tmcct(struct kvm_lapic *apic) { ktime_t remaining; s64 ns; u32 tmcct; ASSERT(apic != NULL); /* if initial count is 0, current count should also be 0 */ if (kvm_apic_get_reg(apic, APIC_TMICT) == 0) return 0; remaining = hrtimer_get_remaining(&apic->lapic_timer.timer); if (ktime_to_ns(remaining) < 0) remaining = ktime_set(0, 0); ns = mod_64(ktime_to_ns(remaining), apic->lapic_timer.period); tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->divide_count)); return tmcct; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void sqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){ #ifndef SQLITE_OMIT_SUBQUERY if( pExpr->flags & EP_xIsSelect ){ sqlite3SubselectError(pParse, pExpr->x.pSelect->pEList->nExpr, 1); }else #endif { sqlite3ErrorMsg(pParse, "row value misused"); } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool wait_for_refresh, ulong timeout) { bool result= FALSE; struct timespec abstime; tdc_version_t refresh_version; DBUG_ENTER("close_cached_tables"); DBUG_ASSERT(thd || (!wait_for_refresh && !tables)); refresh_version= tdc_increment_refresh_version(); if (!tables) { /* Force close of all open tables. Note that code in TABLE_SHARE::wait_for_old_version() assumes that incrementing of refresh_version is followed by purge of unused table shares. */ kill_delayed_threads(); /* Get rid of all unused TABLE and TABLE_SHARE instances. By doing this we automatically close all tables which were marked as "old". */ tc_purge(true); /* Free table shares which were not freed implicitly by loop above. */ tdc_purge(true); } else { bool found=0; for (TABLE_LIST *table= tables; table; table= table->next_local) { /* tdc_remove_table() also sets TABLE_SHARE::version to 0. */ found|= tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED, table->db.str, table->table_name.str, TRUE); } if (!found) wait_for_refresh=0; // Nothing to wait for } DBUG_PRINT("info", ("open table definitions: %d", (int) tdc_records())); if (!wait_for_refresh) DBUG_RETURN(result); if (thd->locked_tables_mode) { /* If we are under LOCK TABLES, we need to reopen the tables without opening a door for any concurrent threads to sneak in and get lock on our tables. To achieve this we use exclusive metadata locks. */ TABLE_LIST *tables_to_reopen= (tables ? tables : thd->locked_tables_list.locked_tables()); /* Close open HANDLER instances to avoid self-deadlock. */ mysql_ha_flush_tables(thd, tables_to_reopen); for (TABLE_LIST *table_list= tables_to_reopen; table_list; table_list= table_list->next_global) { int err; /* A check that the table was locked for write is done by the caller. */ TABLE *table= find_table_for_mdl_upgrade(thd, table_list->db.str, table_list->table_name.str, &err); /* May return NULL if this table has already been closed via an alias. */ if (! table) continue; if (wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_FORCED_CLOSE)) { result= TRUE; goto err_with_reopen; } close_all_tables_for_name(thd, table->s, HA_EXTRA_NOT_USED, NULL); } } /* Wait until all threads have closed all the tables we are flushing. */ DBUG_PRINT("info", ("Waiting for other threads to close their open tables")); /* To a self-deadlock or deadlocks with other FLUSH threads waiting on our open HANDLERs, we have to flush them. */ mysql_ha_flush(thd); DEBUG_SYNC(thd, "after_flush_unlock"); if (!tables) { int r= 0; close_cached_tables_arg argument; argument.refresh_version= refresh_version; set_timespec(abstime, timeout); while (!thd->killed && (r= tdc_iterate(thd, (my_hash_walk_action) close_cached_tables_callback, &argument)) == 1 && !argument.element->share->wait_for_old_version(thd, &abstime, MDL_wait_for_subgraph::DEADLOCK_WEIGHT_DDL)) /* no-op */; if (r) result= TRUE; } else { for (TABLE_LIST *table= tables; table; table= table->next_local) { if (thd->killed) break; if (tdc_wait_for_old_version(thd, table->db.str, table->table_name.str, timeout, MDL_wait_for_subgraph::DEADLOCK_WEIGHT_DDL, refresh_version)) { result= TRUE; break; } } } err_with_reopen: if (thd->locked_tables_mode) { /* No other thread has the locked tables open; reopen them and get the old locks. This should always succeed (unless some external process has removed the tables) */ if (thd->locked_tables_list.reopen_tables(thd, false)) result= true; /* Since downgrade_lock() won't do anything with shared metadata lock it is much simpler to go through all open tables rather than picking only those tables that were flushed. */ for (TABLE *tab= thd->open_tables; tab; tab= tab->next) tab->mdl_ticket->downgrade_lock(MDL_SHARED_NO_READ_WRITE); } DBUG_RETURN(result); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [R_API RBinJavaAttrInfo *r_bin_java_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { // NOTE: this function receives the buffer offset in the original buffer, // but the buffer is already point to that particular offset. // XXX - all the code that relies on this function should probably be modified // so that the original buffer pointer is passed in and then the buffer+buf_offset // points to the correct location. RBinJavaAttrInfo *attr = R_NEW0 (RBinJavaAttrInfo); if (!attr) { return NULL; } RBinJavaAttrMetas *type_info = NULL; attr->metas = R_NEW0 (RBinJavaMetaInfo); if (attr->metas == NULL) { free (attr); return NULL; } attr->is_attr_in_old_format = r_bin_java_is_old_format(bin); attr->file_offset = buf_offset; attr->name_idx = R_BIN_JAVA_USHORT (buffer, 0); attr->length = R_BIN_JAVA_UINT (buffer, 2); attr->size = R_BIN_JAVA_UINT (buffer, 2) + 6; attr->name = r_bin_java_get_utf8_from_bin_cp_list (R_BIN_JAVA_GLOBAL_BIN, attr->name_idx); if (attr->name == NULL) { // Something bad has happened attr->name = r_str_dup (NULL, "NULL"); eprintf ("r_bin_java_default_attr_new: Unable to find the name for %d index.\n", attr->name_idx); } type_info = r_bin_java_get_attr_type_by_name (attr->name); attr->metas->ord = (R_BIN_JAVA_GLOBAL_BIN->attr_idx++); attr->metas->type_info = (void *) type_info; // IFDBG eprintf (" Addrs for type_info [tag=%d]: 0x%08"PFMT64x"\n", type_val, &attr->metas->type_info); return attr; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [uint ha_partition::count_query_cache_dependant_tables(uint8 *tables_type) { DBUG_ENTER("ha_partition::count_query_cache_dependant_tables"); /* Here we rely on the fact that all tables are of the same type */ uint8 type= m_file[0]->table_cache_type(); (*tables_type)|= type; DBUG_PRINT("info", ("cnt: %u", (uint)m_tot_parts)); /* We need save underlying tables only for HA_CACHE_TBL_ASKTRANSACT: HA_CACHE_TBL_NONTRANSACT - because all changes goes through partition table HA_CACHE_TBL_NOCACHE - because will not be cached HA_CACHE_TBL_TRANSACT - QC need to know that such type present */ DBUG_RETURN(type == HA_CACHE_TBL_ASKTRANSACT ? m_tot_parts : 0); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_, const struct isakmp_gen *ext, u_int oprop_length, const u_char *ep, int depth) { const struct ikev2_p *p; struct ikev2_p prop; u_int prop_length; const u_char *cp; int i; int tcount; u_char np; struct isakmp_gen e; u_int item_len; p = (const struct ikev2_p *)ext; ND_TCHECK(*p); UNALIGNED_MEMCPY(&prop, ext, sizeof(prop)); ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), prop.h.critical); /* * ikev2_sa_print() guarantees that this is >= 4. */ prop_length = oprop_length - 4; ND_PRINT((ndo," #%u protoid=%s transform=%d len=%u", prop.p_no, PROTOIDSTR(prop.prot_id), prop.num_t, oprop_length)); cp = (const u_char *)(p + 1); if (prop.spi_size) { if (prop_length < prop.spi_size) goto toolong; ND_PRINT((ndo," spi=")); if (!rawprint(ndo, (const uint8_t *)cp, prop.spi_size)) goto trunc; cp += prop.spi_size; prop_length -= prop.spi_size; } /* * Print the transforms. */ tcount = 0; for (np = ISAKMP_NPTYPE_T; np != 0; np = e.np) { tcount++; ext = (const struct isakmp_gen *)cp; if (prop_length < sizeof(*ext)) goto toolong; ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); /* * Since we can't have a payload length of less than 4 bytes, * we need to bail out here if the generic header is nonsensical * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ item_len = ntohs(e.len); if (item_len <= 4) goto trunc; if (prop_length < item_len) goto toolong; ND_TCHECK2(*cp, item_len); depth++; ND_PRINT((ndo,"\n")); for (i = 0; i < depth; i++) ND_PRINT((ndo," ")); ND_PRINT((ndo,"(")); if (np == ISAKMP_NPTYPE_T) { cp = ikev2_t_print(ndo, tcount, ext, item_len, ep); if (cp == NULL) { /* error, already reported */ return NULL; } } else { ND_PRINT((ndo, "%s", NPSTR(np))); cp += item_len; } ND_PRINT((ndo,")")); depth--; prop_length -= item_len; } return cp; toolong: /* * Skip the rest of the proposal. */ cp += prop_length; ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_P))); return cp; trunc: ND_PRINT((ndo," [|%s]", NPSTR(ISAKMP_NPTYPE_P))); return NULL; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int ssl3_get_server_hello(SSL *s) { STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *c; unsigned char *p,*d; int i,al,ok; unsigned int j; long n; #ifndef OPENSSL_NO_COMP SSL_COMP *comp; #endif n=s->method->ssl_get_message(s, SSL3_ST_CR_SRVR_HELLO_A, SSL3_ST_CR_SRVR_HELLO_B, -1, 20000, /* ?? */ &ok); if (!ok) return((int)n); if ( SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER) { if ( s->s3->tmp.message_type == DTLS1_MT_HELLO_VERIFY_REQUEST) { if ( s->d1->send_cookie == 0) { s->s3->tmp.reuse_message = 1; return 1; } else /* already sent a cookie */ { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_MESSAGE_TYPE); goto f_err; } } } if ( s->s3->tmp.message_type != SSL3_MT_SERVER_HELLO) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_MESSAGE_TYPE); goto f_err; } d=p=(unsigned char *)s->init_msg; if ((p[0] != (s->version>>8)) || (p[1] != (s->version&0xff))) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_SSL_VERSION); s->version=(s->version&0xff00)|p[1]; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } p+=2; /* load the server hello data */ /* load the server random */ memcpy(s->s3->server_random,p,SSL3_RANDOM_SIZE); p+=SSL3_RANDOM_SIZE; /* get the session-id */ j= *(p++); if ((j > sizeof s->session->session_id) || (j > SSL3_SESSION_ID_SIZE)) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_SSL3_SESSION_ID_TOO_LONG); goto f_err; } if (j != 0 && j == s->session->session_id_length && memcmp(p,s->session->session_id,j) == 0) { if(s->sid_ctx_length != s->session->sid_ctx_length || memcmp(s->session->sid_ctx,s->sid_ctx,s->sid_ctx_length)) { /* actually a client application bug */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT); goto f_err; } s->s3->flags |= SSL3_FLAGS_CCS_OK; s->hit=1; } else /* a miss or crap from the other end */ { /* If we were trying for session-id reuse, make a new * SSL_SESSION so we don't stuff up other people */ s->hit=0; if (s->session->session_id_length > 0) { if (!ssl_get_new_session(s,0)) { al=SSL_AD_INTERNAL_ERROR; goto f_err; } } s->session->session_id_length=j; memcpy(s->session->session_id,p,j); /* j could be 0 */ } p+=j; c=ssl_get_cipher_by_char(s,p); if (c == NULL) { /* unknown cipher */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNKNOWN_CIPHER_RETURNED); goto f_err; } p+=ssl_put_cipher_by_char(s,NULL,NULL); sk=ssl_get_ciphers_by_id(s); i=sk_SSL_CIPHER_find(sk,c); if (i < 0) { /* we did not say we would use this cipher */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_CIPHER_RETURNED); goto f_err; } /* Depending on the session caching (internal/external), the cipher and/or cipher_id values may not be set. Make sure that cipher_id is set and use it for comparison. */ if (s->session->cipher) s->session->cipher_id = s->session->cipher->id; if (s->hit && (s->session->cipher_id != c->id)) { /* Workaround is now obsolete */ #if 0 if (!(s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG)) #endif { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED); goto f_err; } } s->s3->tmp.new_cipher=c; /* lets get the compression algorithm */ /* COMPRESSION */ #ifdef OPENSSL_NO_COMP if (*(p++) != 0) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM); goto f_err; } #else j= *(p++); if (j == 0) comp=NULL; else comp=ssl3_comp_find(s->ctx->comp_methods,j); if ((j != 0) && (comp == NULL)) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM); goto f_err; } else { s->s3->tmp.new_compression=comp; } #endif #ifndef OPENSSL_NO_TLSEXT /* TLS extensions*/ if (s->version >= SSL3_VERSION) { if (!ssl_parse_serverhello_tlsext(s,&p,d,n, &al)) { /* 'al' set by ssl_parse_serverhello_tlsext */ SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_PARSE_TLSEXT); goto f_err; } if (ssl_check_serverhello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_SERVERHELLO_TLSEXT); goto err; } } #endif if (p != (d+n)) { /* wrong packet length */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_BAD_PACKET_LENGTH); goto f_err; } return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); #ifndef OPENSSL_NO_TLSEXT err: #endif return(-1); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void __init sev_set_cpu_caps(void) { if (!sev_enabled) kvm_cpu_cap_clear(X86_FEATURE_SEV); if (!sev_es_enabled) kvm_cpu_cap_clear(X86_FEATURE_SEV_ES); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ void Compute(OpKernelContext* context) override { const Tensor& input_sizes = context->input(0); const Tensor& filter = context->input(1); OP_REQUIRES( context, TensorShapeUtils::IsVector(input_sizes.shape()), errors::InvalidArgument( "Conv2DBackpropInput: input_sizes input must be 1-dim, not ", input_sizes.dims())); TensorShape input_shape; const int32* in_sizes_data = input_sizes.template flat<int32>().data(); for (int i = 0; i < input_sizes.NumElements(); ++i) { OP_REQUIRES(context, in_sizes_data[i] >= 0, errors::InvalidArgument("Dimension ", i, " of input_sizes must be >= 0")); input_shape.AddDim(in_sizes_data[i]); } const TensorShape& filter_shape = filter.shape(); EXTRACT_AND_VERIFY_DIMENSIONS("DepthwiseConv2DBackpropInput"); Tensor* in_backprop = nullptr; OP_REQUIRES_OK(context, context->forward_input_or_allocate_output( {0}, 0, input_shape, &in_backprop)); // If there is nothing to compute, return. if (input_shape.num_elements() == 0) { return; } // If in_depth==1, this operation is just a standard convolution. // Depthwise convolution is a special case of cuDNN's grouped convolution. bool use_cudnn = std::is_same<Device, GPUDevice>::value && (in_depth == 1 || (use_cudnn_grouped_conv_ && IsCudnnSupportedFilterSize(/*filter_rows=*/filter_rows, /*filter_cols=*/filter_cols, /*in_depth=*/in_depth, /*out_depth=*/out_depth))); VLOG(2) << "DepthwiseConv2dNativeBackpropInput: " << " Input: [" << batch << ", " << input_rows << ", " << input_cols << ", " << in_depth << "]; Filter: [" << filter_rows << ", " << filter_cols << ", " << in_depth << ", " << depth_multiplier << "]; Output: [" << batch << ", " << out_rows << ", " << out_cols << ", " << out_depth << "], stride = " << stride_ << ", pad_rows = " << pad_top << ", pad_cols = " << pad_left << ", Use cuDNN: " << use_cudnn; if (use_cudnn) { // Reshape from TF depthwise filter to cuDNN grouped convolution filter: // // | TensorFlow | cuDNN // -------------------------------------------------------------------- // filter_out_depth | depth_multiplier | depth_multiplier * group_count // filter_in_depth | in_depth | in_depth / group_count // // For depthwise convolution, we have group_count == in_depth. int32_t filter_in_depth = 1; TensorShape shape = TensorShape{filter_rows, filter_cols, filter_in_depth, out_depth}; Tensor reshaped_filter(/*type=*/dtype_); OP_REQUIRES( context, reshaped_filter.CopyFrom(filter, shape), errors::Internal( "Failed to reshape filter tensor for grouped convolution.")); // TODO(yangzihao): Send in arbitrary dilation rates after the dilated // conv is supported. launcher_(context, /*use_cudnn=*/true, cudnn_use_autotune_, out_backprop, reshaped_filter, /*row_dilation=*/1, /*col_dilation=*/1, stride_, stride_, padding_, explicit_paddings_, in_backprop, data_format_); return; } auto out_backprop_ptr = out_backprop.template flat<T>().data(); auto filter_ptr = filter.template flat<T>().data(); auto in_backprop_ptr = in_backprop->template flat<T>().data(); LaunchDepthwiseConvBackpropInputOp<Device, T>()( context, args, out_backprop_ptr, filter_ptr, in_backprop_ptr, data_format_); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [netsnmp_init_mib(void) { const char *prefix; char *env_var, *entry; PrefixListPtr pp = &mib_prefixes[0]; char *st = NULL; if (Mib) return; netsnmp_init_mib_internals(); /* * Initialise the MIB directory/ies */ netsnmp_fixup_mib_directory(); env_var = strdup(netsnmp_get_mib_directory()); if (!env_var) return; DEBUGMSGTL(("init_mib", "Seen MIBDIRS: Looking in '%s' for mib dirs ...\n", env_var)); entry = strtok_r(env_var, ENV_SEPARATOR, &st); while (entry) { add_mibdir(entry); entry = strtok_r(NULL, ENV_SEPARATOR, &st); } SNMP_FREE(env_var); env_var = netsnmp_getenv("MIBFILES"); if (env_var != NULL) { if (*env_var == '+') entry = strtok_r(env_var+1, ENV_SEPARATOR, &st); else entry = strtok_r(env_var, ENV_SEPARATOR, &st); while (entry) { add_mibfile(entry, NULL); entry = strtok_r(NULL, ENV_SEPARATOR, &st); } } netsnmp_init_mib_internals(); /* * Read in any modules or mibs requested */ env_var = netsnmp_getenv("MIBS"); if (env_var == NULL) { if (confmibs != NULL) env_var = strdup(confmibs); else env_var = strdup(NETSNMP_DEFAULT_MIBS); } else { env_var = strdup(env_var); } if (env_var && ((*env_var == '+') || (*env_var == '-'))) { entry = (char *) malloc(strlen(NETSNMP_DEFAULT_MIBS) + strlen(env_var) + 2); if (!entry) { DEBUGMSGTL(("init_mib", "env mibs malloc failed")); SNMP_FREE(env_var); return; } else { if (*env_var == '+') sprintf(entry, "%s%c%s", NETSNMP_DEFAULT_MIBS, ENV_SEPARATOR_CHAR, env_var+1); else sprintf(entry, "%s%c%s", env_var+1, ENV_SEPARATOR_CHAR, NETSNMP_DEFAULT_MIBS ); } SNMP_FREE(env_var); env_var = entry; } DEBUGMSGTL(("init_mib", "Seen MIBS: Looking in '%s' for mib files ...\n", env_var)); entry = strtok_r(env_var, ENV_SEPARATOR, &st); while (entry) { if (strcasecmp(entry, DEBUG_ALWAYS_TOKEN) == 0) { read_all_mibs(); } else if (strstr(entry, "/") != NULL) { read_mib(entry); } else { netsnmp_read_module(entry); } entry = strtok_r(NULL, ENV_SEPARATOR, &st); } adopt_orphans(); SNMP_FREE(env_var); env_var = netsnmp_getenv("MIBFILES"); if (env_var != NULL) { if ((*env_var == '+') || (*env_var == '-')) { #ifdef NETSNMP_DEFAULT_MIBFILES entry = (char *) malloc(strlen(NETSNMP_DEFAULT_MIBFILES) + strlen(env_var) + 2); if (!entry) { DEBUGMSGTL(("init_mib", "env mibfiles malloc failed")); } else { if (*env_var++ == '+') sprintf(entry, "%s%c%s", NETSNMP_DEFAULT_MIBFILES, ENV_SEPARATOR_CHAR, env_var ); else sprintf(entry, "%s%c%s", env_var, ENV_SEPARATOR_CHAR, NETSNMP_DEFAULT_MIBFILES ); } SNMP_FREE(env_var); env_var = entry; #else env_var = strdup(env_var + 1); #endif } else { env_var = strdup(env_var); } } else { #ifdef NETSNMP_DEFAULT_MIBFILES env_var = strdup(NETSNMP_DEFAULT_MIBFILES); #endif } if (env_var != NULL) { DEBUGMSGTL(("init_mib", "Seen MIBFILES: Looking in '%s' for mib files ...\n", env_var)); entry = strtok_r(env_var, ENV_SEPARATOR, &st); while (entry) { read_mib(entry); entry = strtok_r(NULL, ENV_SEPARATOR, &st); } SNMP_FREE(env_var); } prefix = netsnmp_getenv("PREFIX"); if (!prefix) prefix = Standard_Prefix; Prefix = (char *) malloc(strlen(prefix) + 2); if (!Prefix) DEBUGMSGTL(("init_mib", "Prefix malloc failed")); else strcpy(Prefix, prefix); DEBUGMSGTL(("init_mib", "Seen PREFIX: Looking in '%s' for prefix ...\n", Prefix)); /* * remove trailing dot */ if (Prefix) { env_var = &Prefix[strlen(Prefix) - 1]; if (*env_var == '.') *env_var = '\0'; } pp->str = Prefix; /* fixup first mib_prefix entry */ /* * now that the list of prefixes is built, save each string length. */ while (pp->str) { pp->len = strlen(pp->str); pp++; } Mib = tree_head; /* Backwards compatibility */ tree_top = (struct tree *) calloc(1, sizeof(struct tree)); /* * XX error check ? */ if (tree_top) { tree_top->label = strdup("(top)"); tree_top->child_list = tree_head; } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static RList *carve_kexts(RKernelCacheObj *obj, RBinFile *bf) { struct section_t *sections = NULL; if (!(sections = MACH0_(get_sections) (obj->mach0))) { return NULL; } ut64 pa2va_exec = 0; ut64 pa2va_data = 0; ut64 kmod_start = 0, kmod_end = 0; ut64 kmod_info = 0, kmod_info_end = 0; int incomplete = 4; RKmodInfo *all_infos = NULL; int i = 0; for (; !sections[i].last && incomplete > 0; i++) { if (strstr (sections[i].name, "__TEXT_EXEC.__text")) { pa2va_exec = sections[i].addr - sections[i].offset; incomplete--; } if (strstr (sections[i].name, "__DATA.__data")) { pa2va_data = sections[i].addr - sections[i].offset; incomplete--; } if (strstr (sections[i].name, "__PRELINK_INFO.__kmod_start")) { kmod_start = sections[i].offset; kmod_end = kmod_start + sections[i].size; incomplete--; } if (strstr (sections[i].name, "__PRELINK_INFO.__kmod_info")) { kmod_info = sections[i].offset; kmod_info_end = kmod_info + sections[i].size; incomplete--; } } R_FREE (sections); if (incomplete) { return NULL; } RList *kexts = r_list_newf ((RListFree) &r_kext_free); if (!kexts) { return NULL; } int n_kmod_info = (kmod_info_end - kmod_info) / 8; if (n_kmod_info == 0) { goto beach; } all_infos = R_NEWS0 (RKmodInfo, n_kmod_info); if (!all_infos) { goto beach; } ut8 bytes[8]; int j = 0; for (; j < n_kmod_info; j++) { ut64 entry_offset = j * 8 + kmod_info; if (r_buf_read_at (obj->cache_buf, entry_offset, bytes, 8) < 8) { goto beach; } ut64 kmod_info_paddr = K_RPTR (bytes) - pa2va_data; ut64 field_name = kmod_info_paddr + 0x10; ut64 field_start = kmod_info_paddr + 0xb4; if (r_buf_read_at (obj->cache_buf, field_start, bytes, 8) < 8) { goto beach; } all_infos[j].start = K_RPTR (bytes); if (r_buf_read_at (obj->cache_buf, field_name, (ut8 *) all_infos[j].name, 0x40) < 0x40) { goto beach; } all_infos[j].name[0x40] = 0; } ut64 cursor = kmod_start; for(; cursor < kmod_end; cursor += 8) { ut8 bytes[8]; if (r_buf_read_at (obj->cache_buf, cursor, bytes, 8) < 8) { goto beach; } RKext *kext = R_NEW0 (RKext); if (!kext) { goto beach; } kext->vaddr = K_RPTR (bytes); kext->range.offset = kext->vaddr - pa2va_exec; kext->mach0 = create_kext_mach0 (obj, kext, bf); if (!kext->mach0) { r_kext_free (kext); continue; } r_kext_fill_text_range (kext); kext->vaddr = K_PPTR (kext->vaddr); kext->pa2va_exec = pa2va_exec; kext->pa2va_data = pa2va_data; ut64 text_start = kext->vaddr; ut64 text_end = text_start + kext->text_range.size; if (text_start == text_end) { r_kext_free (kext); continue; } for (j = 0; j < n_kmod_info; j++) { if (text_start > all_infos[j].start || all_infos[j].start >= text_end) { continue; } kext->name = strdup (all_infos[j].name); kext->own_name = true; break; } if (!kext->name) { r_kext_free (kext); continue; } r_list_push (kexts, kext); } R_FREE (all_infos); return kexts; beach: r_list_free (kexts); R_FREE (all_infos); return NULL; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive_name, const void *pBuf, size_t buf_size, mz_uint level_and_flags) { return mz_zip_writer_add_mem_ex(pZip, pArchive_name, pBuf, buf_size, NULL, 0, level_and_flags, 0, 0); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ Http2CodecImplTestFixture(Http2SettingsTuple client_settings, Http2SettingsTuple server_settings) : client_settings_(client_settings), server_settings_(server_settings) {}] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void __dvb_frontend_free(struct dvb_frontend *fe) { struct dvb_frontend_private *fepriv = fe->frontend_priv; if (fepriv) dvb_free_device(fepriv->dvbdev); dvb_frontend_invoke_release(fe, fe->ops.release); if (!fepriv) return; kfree(fepriv); fe->frontend_priv = NULL; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int compare_order_elements(ORDER *ord1, ORDER *ord2) { if (*ord1->item == *ord2->item && ord1->direction == ord2->direction) return CMP_EQ; Item *item1= (*ord1->item)->real_item(); Item *item2= (*ord2->item)->real_item(); DBUG_ASSERT(item1->type() == Item::FIELD_ITEM && item2->type() == Item::FIELD_ITEM); ptrdiff_t cmp= ((Item_field *) item1)->field - ((Item_field *) item2)->field; if (cmp == 0) { if (ord1->direction == ord2->direction) return CMP_EQ; return ord1->direction > ord2->direction ? CMP_GT : CMP_LT; } else return cmp > 0 ? CMP_GT : CMP_LT; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) { SSL_CTX *ret=NULL; if (meth == NULL) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_NULL_SSL_METHOD_PASSED); return(NULL); } if (SSL_get_ex_data_X509_STORE_CTX_idx() < 0) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); goto err; } ret=(SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX)); if (ret == NULL) goto err; memset(ret,0,sizeof(SSL_CTX)); ret->method=meth; ret->cert_store=NULL; ret->session_cache_mode=SSL_SESS_CACHE_SERVER; ret->session_cache_size=SSL_SESSION_CACHE_MAX_SIZE_DEFAULT; ret->session_cache_head=NULL; ret->session_cache_tail=NULL; /* We take the system default */ ret->session_timeout=meth->get_timeout(); ret->new_session_cb=0; ret->remove_session_cb=0; ret->get_session_cb=0; ret->generate_session_id=0; memset((char *)&ret->stats,0,sizeof(ret->stats)); ret->references=1; ret->quiet_shutdown=0; /* ret->cipher=NULL;*/ /* ret->s2->challenge=NULL; ret->master_key=NULL; ret->key_arg=NULL; ret->s2->conn_id=NULL; */ ret->info_callback=NULL; ret->app_verify_callback=0; ret->app_verify_arg=NULL; ret->max_cert_list=SSL_MAX_CERT_LIST_DEFAULT; ret->read_ahead=0; ret->msg_callback=0; ret->msg_callback_arg=NULL; ret->verify_mode=SSL_VERIFY_NONE; #if 0 ret->verify_depth=-1; /* Don't impose a limit (but x509_lu.c does) */ #endif ret->sid_ctx_length=0; ret->default_verify_callback=NULL; if ((ret->cert=ssl_cert_new()) == NULL) goto err; ret->default_passwd_callback=0; ret->default_passwd_callback_userdata=NULL; ret->client_cert_cb=0; ret->app_gen_cookie_cb=0; ret->app_verify_cookie_cb=0; ret->sessions=lh_SSL_SESSION_new(); if (ret->sessions == NULL) goto err; ret->cert_store=X509_STORE_new(); if (ret->cert_store == NULL) goto err; ssl_create_cipher_list(ret->method, &ret->cipher_list,&ret->cipher_list_by_id, meth->version == SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST); if (ret->cipher_list == NULL || sk_SSL_CIPHER_num(ret->cipher_list) <= 0) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_LIBRARY_HAS_NO_CIPHERS); goto err2; } ret->param = X509_VERIFY_PARAM_new(); if (!ret->param) goto err; if ((ret->rsa_md5=EVP_get_digestbyname("ssl2-md5")) == NULL) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES); goto err2; } if ((ret->md5=EVP_get_digestbyname("ssl3-md5")) == NULL) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES); goto err2; } if ((ret->sha1=EVP_get_digestbyname("ssl3-sha1")) == NULL) { SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES); goto err2; } if ((ret->client_CA=sk_X509_NAME_new_null()) == NULL) goto err; CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_CTX, ret, &ret->ex_data); ret->extra_certs=NULL; ret->comp_methods=SSL_COMP_get_compression_methods(); ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; #ifndef OPENSSL_NO_TLSEXT ret->tlsext_servername_callback = 0; ret->tlsext_servername_arg = NULL; /* Setup RFC4507 ticket keys */ if ((RAND_pseudo_bytes(ret->tlsext_tick_key_name, 16) <= 0) || (RAND_bytes(ret->tlsext_tick_hmac_key, 16) <= 0) || (RAND_bytes(ret->tlsext_tick_aes_key, 16) <= 0)) ret->options |= SSL_OP_NO_TICKET; ret->tlsext_status_cb = 0; ret->tlsext_status_arg = NULL; #endif #ifndef OPENSSL_NO_PSK ret->psk_identity_hint=NULL; ret->psk_client_callback=NULL; ret->psk_server_callback=NULL; #endif #ifndef OPENSSL_NO_BUF_FREELISTS ret->freelist_max_len = SSL_MAX_BUF_FREELIST_LEN_DEFAULT; ret->rbuf_freelist = OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST)); if (!ret->rbuf_freelist) goto err; ret->rbuf_freelist->chunklen = 0; ret->rbuf_freelist->len = 0; ret->rbuf_freelist->head = NULL; ret->wbuf_freelist = OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST)); if (!ret->wbuf_freelist) { OPENSSL_free(ret->rbuf_freelist); goto err; } ret->wbuf_freelist->chunklen = 0; ret->wbuf_freelist->len = 0; ret->wbuf_freelist->head = NULL; #endif #ifndef OPENSSL_NO_ENGINE ret->client_cert_engine = NULL; #ifdef OPENSSL_SSL_CLIENT_ENGINE_AUTO #define eng_strx(x) #x #define eng_str(x) eng_strx(x) /* Use specific client engine automatically... ignore errors */ { ENGINE *eng; eng = ENGINE_by_id(eng_str(OPENSSL_SSL_CLIENT_ENGINE_AUTO)); if (!eng) { ERR_clear_error(); ENGINE_load_builtin_engines(); eng = ENGINE_by_id(eng_str(OPENSSL_SSL_CLIENT_ENGINE_AUTO)); } if (!eng || !SSL_CTX_set_client_cert_engine(ret, eng)) ERR_clear_error(); } #endif #endif /* Default is to connect to non-RI servers. When RI is more widely * deployed might change this. */ ret->options |= SSL_OP_LEGACY_SERVER_CONNECT; return(ret); err: SSLerr(SSL_F_SSL_CTX_NEW,ERR_R_MALLOC_FAILURE); err2: if (ret != NULL) SSL_CTX_free(ret); return(NULL); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void temac_start_xmit_done(struct net_device *ndev) { struct temac_local *lp = netdev_priv(ndev); struct cdmac_bd *cur_p; unsigned int stat = 0; struct sk_buff *skb; cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; stat = be32_to_cpu(cur_p->app0); while (stat & STS_CTRL_APP0_CMPLT) { /* Make sure that the other fields are read after bd is * released by dma */ rmb(); dma_unmap_single(ndev->dev.parent, be32_to_cpu(cur_p->phys), be32_to_cpu(cur_p->len), DMA_TO_DEVICE); skb = (struct sk_buff *)ptr_from_txbd(cur_p); if (skb) dev_consume_skb_irq(skb); cur_p->app1 = 0; cur_p->app2 = 0; cur_p->app3 = 0; cur_p->app4 = 0; ndev->stats.tx_packets++; ndev->stats.tx_bytes += be32_to_cpu(cur_p->len); /* app0 must be visible last, as it is used to flag * availability of the bd */ smp_mb(); cur_p->app0 = 0; lp->tx_bd_ci++; if (lp->tx_bd_ci >= lp->tx_bd_num) lp->tx_bd_ci = 0; cur_p = &lp->tx_bd_v[lp->tx_bd_ci]; stat = be32_to_cpu(cur_p->app0); } /* Matches barrier in temac_start_xmit */ smp_mb(); netif_wake_queue(ndev); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int jmapquery(void *sc, void *mc, const char *json) { script_data_t *sd = (script_data_t *) sc; message_data_t *md = ((deliver_data_t *) mc)->m; struct buf msg = BUF_INITIALIZER; const char *userid = mbname_userid(sd->mbname); json_error_t jerr; json_t *jfilter, *err = NULL; int r; /* Create filter from json */ jfilter = json_loads(json, 0, &jerr); if (!jfilter) return 0; /* mmap the staged message file */ buf_refresh_mmap(&msg, 1, fileno(md->f), md->id, md->size, NULL); /* Run query */ r = jmap_email_matchmime(&msg, jfilter, userid, time(NULL), &err); if (err) { char *errstr = json_dumps(err, JSON_COMPACT); syslog(LOG_ERR, "sieve: jmapquery error: %s", errstr); free(errstr); r = SIEVE_RUN_ERROR; } json_decref(jfilter); buf_free(&msg); return r; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) { struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data; u16 scid, flags, result; struct l2cap_chan *chan; int len = cmd_len - sizeof(*rsp); int err = 0; if (cmd_len < sizeof(*rsp)) return -EPROTO; scid = __le16_to_cpu(rsp->scid); flags = __le16_to_cpu(rsp->flags); result = __le16_to_cpu(rsp->result); BT_DBG("scid 0x%4.4x flags 0x%2.2x result 0x%2.2x len %d", scid, flags, result, len); chan = l2cap_get_chan_by_scid(conn, scid); if (!chan) return 0; switch (result) { case L2CAP_CONF_SUCCESS: l2cap_conf_rfc_get(chan, rsp->data, len); clear_bit(CONF_REM_CONF_PEND, &chan->conf_state); break; case L2CAP_CONF_PENDING: set_bit(CONF_REM_CONF_PEND, &chan->conf_state); if (test_bit(CONF_LOC_CONF_PEND, &chan->conf_state)) { char buf[64]; len = l2cap_parse_conf_rsp(chan, rsp->data, len, buf, sizeof(buf), &result); if (len < 0) { l2cap_send_disconn_req(chan, ECONNRESET); goto done; } if (!chan->hs_hcon) { l2cap_send_efs_conf_rsp(chan, buf, cmd->ident, 0); } else { if (l2cap_check_efs(chan)) { amp_create_logical_link(chan); chan->ident = cmd->ident; } } } goto done; case L2CAP_CONF_UNACCEPT: if (chan->num_conf_rsp <= L2CAP_CONF_MAX_CONF_RSP) { char req[64]; if (len > sizeof(req) - sizeof(struct l2cap_conf_req)) { l2cap_send_disconn_req(chan, ECONNRESET); goto done; } /* throw out any old stored conf requests */ result = L2CAP_CONF_SUCCESS; len = l2cap_parse_conf_rsp(chan, rsp->data, len, req, sizeof(req), &result); if (len < 0) { l2cap_send_disconn_req(chan, ECONNRESET); goto done; } l2cap_send_cmd(conn, l2cap_get_ident(conn), L2CAP_CONF_REQ, len, req); chan->num_conf_req++; if (result != L2CAP_CONF_SUCCESS) goto done; break; } default: l2cap_chan_set_err(chan, ECONNRESET); __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); l2cap_send_disconn_req(chan, ECONNRESET); goto done; } if (flags & L2CAP_CONF_FLAG_CONTINUATION) goto done; set_bit(CONF_INPUT_DONE, &chan->conf_state); if (test_bit(CONF_OUTPUT_DONE, &chan->conf_state)) { set_default_fcs(chan); if (chan->mode == L2CAP_MODE_ERTM || chan->mode == L2CAP_MODE_STREAMING) err = l2cap_ertm_init(chan); if (err < 0) l2cap_send_disconn_req(chan, -err); else l2cap_chan_ready(chan); } done: l2cap_chan_unlock(chan); return err; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ void parseTest(fs::path testFilePath) { _testFilePath = testFilePath.string(); LOGV2(4333507, "### Parsing Test ###", "testFilePath"_attr = testFilePath.string()); { std::ifstream testFile(_testFilePath); std::ostringstream json; json << testFile.rdbuf(); _jsonTest = fromjson(json.str()); } // Do this first to save the state if (_jsonTest.hasField("error")) { LOGV2(5017004, "Expecting test case to generate an error."); _errorExpected = _jsonTest.getBoolField("error"); } // The json tests pass in capitalized keywords for mode, but the server only accepts // lowercased keywords. Also, change the key "tags_set" to "tags". // This can throw for test cases that have invalid read preferences. auto readPrefObj = _jsonTest.getObjectField("read_preference"); std::string mode = readPrefObj.getStringField("mode"); mode[0] = std::tolower(mode[0]); auto tagSetsObj = readPrefObj["tag_sets"]; auto tags = tagSetsObj ? BSONArray(readPrefObj["tag_sets"].Obj()) : BSONArray(); auto topologyDescriptionObj = _jsonTest.getObjectField("topology_description"); TopologyType initType = uassertStatusOK(parseTopologyType(topologyDescriptionObj.getStringField("type"))); boost::optional<std::string> setName = boost::none; if (initType == TopologyType::kReplicaSetNoPrimary || initType == TopologyType::kSingle) setName = "replset"; int maxStalenessSeconds = 0; if (readPrefObj.hasField("maxStalenessSeconds")) { maxStalenessSeconds = readPrefObj.getIntField("maxStalenessSeconds"); } BSONObj readPref = BSON("mode" << mode << "tags" << tags << "maxStalenessSeconds" << maxStalenessSeconds); auto stalenessParseResult = ReadPreferenceSetting::fromInnerBSON(readPref); if (!_errorExpected && stalenessParseResult.getStatus().code() == ErrorCodes::MaxStalenessOutOfRange && (initType == TopologyType::kUnknown || initType == TopologyType::kSingle || initType == TopologyType::kSharded)) { // Drivers tests expect no error for invalid maxStaleness values for Unknown, Single, // and Sharded topology types. The server code doesn't allow read preferences to be // created for invalid values for maxStaleness, so ignore it. readPref = BSON("mode" << mode << "tags" << tags << "maxStalenessSeconds" << 0); stalenessParseResult = ReadPreferenceSetting::fromInnerBSON(readPref); } else if (_errorExpected && maxStalenessSeconds == 0 && readPrefObj.hasField("maxStalenessSeconds")) { // Generate an error to pass test cases that set max staleness to zero since the server // interprets this as no maxStaleness is specified. uassert(ErrorCodes::MaxStalenessOutOfRange, "max staleness should be >= 0", false); } _readPreference = uassertStatusOK(stalenessParseResult); LOGV2(5017007, "Read Preference", "value"_attr = _readPreference); if (_jsonTest.hasField("heartbeatFrequencyMS")) { sdamHeartBeatFrequencyMs = _jsonTest.getIntField("heartbeatFrequencyMS"); LOGV2(5017003, "Set heartbeatFrequencyMs", "value"_attr = sdamHeartBeatFrequencyMs); } std::vector<ServerDescriptionPtr> serverDescriptions; std::vector<HostAndPort> serverAddresses; const std::vector<BSONElement>& bsonServers = topologyDescriptionObj["servers"].Array(); for (auto bsonServer : bsonServers) { auto server = bsonServer.Obj(); int maxWireVersion = 9; if (server.hasField("maxWireVersion")) { maxWireVersion = server["maxWireVersion"].numberInt(); } auto serverType = uassertStatusOK(parseServerType(server.getStringField("type"))); auto serverDescription = ServerDescriptionBuilder() .withAddress(HostAndPort(server.getStringField("address"))) .withType(serverType) .withRtt(Milliseconds(server["avg_rtt_ms"].numberInt())) .withMinWireVersion(5) .withMaxWireVersion(maxWireVersion); if (server.hasField("lastWrite")) { auto lastWriteDate = server.getObjectField("lastWrite").getIntField("lastWriteDate"); serverDescription.withLastWriteDate(Date_t::fromMillisSinceEpoch(lastWriteDate)); } if (server.hasField("lastUpdateTime")) { auto lastUpdateTime = server.getIntField("lastUpdateTime"); serverDescription.withLastUpdateTime(Date_t::fromMillisSinceEpoch(lastUpdateTime)); } auto tagsObj = server.getObjectField("tags"); const auto keys = tagsObj.getFieldNames<std::set<std::string>>(); for (const auto key : keys) { serverDescription.withTag(key, tagsObj.getStringField(key)); } serverDescriptions.push_back(serverDescription.instance()); LOGV2(5017002, "Server Description", "description"_attr = serverDescriptions.back()->toBson()); serverAddresses.push_back(HostAndPort(server.getStringField("address"))); } boost::optional<std::vector<HostAndPort>> seedList = boost::none; if (serverAddresses.size() > 0) seedList = serverAddresses; auto config = SdamConfiguration(seedList, initType, Milliseconds{sdamHeartBeatFrequencyMs}, Milliseconds{sdamConnectTimeoutMs}, Milliseconds{sdamLocalThreshholdMs}, setName); _topologyDescription = std::make_shared<TopologyDescription>(config); if (_jsonTest.hasField("in_latency_window")) { const std::vector<BSONElement>& bsonLatencyWindow = _jsonTest["in_latency_window"].Array(); for (const auto& serverDescription : serverDescriptions) { _topologyDescription->installServerDescription(serverDescription); for (auto bsonServer : bsonLatencyWindow) { auto server = bsonServer.Obj(); if (serverDescription->getAddress() == HostAndPort(server.getStringField("address"))) { _inLatencyWindow.push_back(serverDescription); } } } } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ecma_bigint_to_number (ecma_value_t value) /**< BigInt value */ { JERRY_ASSERT (ecma_is_value_bigint (value)); if (value == ECMA_BIGINT_ZERO) { return ecma_make_integer_value (0); } ecma_extended_primitive_t *value_p = ecma_get_extended_primitive_from_value (value); uint32_t size = ECMA_BIGINT_GET_SIZE (value_p); ecma_bigint_digit_t *digits_p = ECMA_BIGINT_GET_DIGITS (value_p, size); if (size == sizeof (ecma_bigint_digit_t)) { if (!(value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)) { if (digits_p[-1] <= ECMA_INTEGER_NUMBER_MAX) { return ecma_make_integer_value ((ecma_integer_value_t) digits_p[-1]); } } else if (digits_p[-1] <= -ECMA_INTEGER_NUMBER_MIN) { return ecma_make_integer_value (-(ecma_integer_value_t) digits_p[-1]); } } uint64_t fraction = 0; ecma_bigint_digit_t shift_left; if (digits_p[-1] == 1) { JERRY_ASSERT (size > sizeof (ecma_bigint_digit_t)); fraction = ((uint64_t) digits_p[-2]) << (8 * sizeof (ecma_bigint_digit_t)); shift_left = (uint32_t) (8 * sizeof (ecma_bigint_digit_t)); if (size >= 3 * sizeof (ecma_bigint_digit_t)) { fraction |= (uint64_t) digits_p[-3]; } } else { shift_left = ecma_big_uint_count_leading_zero (digits_p[-1]) + 1; fraction = ((uint64_t) digits_p[-1]) << (8 * sizeof (ecma_bigint_digit_t) + shift_left); if (size >= 2 * sizeof (ecma_bigint_digit_t)) { fraction |= ((uint64_t) digits_p[-2]) << shift_left; } if (size >= 3 * sizeof (ecma_bigint_digit_t)) { fraction |= ((uint64_t) digits_p[-3]) >> (8 * sizeof (ecma_bigint_digit_t) - shift_left); } } uint32_t biased_exp = (uint32_t) (((1 << (ECMA_NUMBER_BIASED_EXP_WIDTH - 1)) - 1) + (size * 8 - shift_left)); /* Rounding result. */ const uint64_t rounding_bit = (((uint64_t) 1) << (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH - 1)); bool round_up = false; if (fraction & rounding_bit) { round_up = true; /* IEEE_754 roundTiesToEven mode: when rounding_bit is set, and all the remaining bits * are zero, the number needs to be rounded down the bit before rounding_bit is zero. */ if ((fraction & ((rounding_bit << 2) - 1)) == rounding_bit) { round_up = false; if ((size >= (3 * sizeof (ecma_bigint_digit_t))) && (shift_left == (8 * sizeof (ecma_bigint_digit_t)) || (digits_p[-3] & ((((ecma_bigint_digit_t) 1) << shift_left) - 1)) == 0)) { ecma_bigint_digit_t *digits_start_p = ECMA_BIGINT_GET_DIGITS (value_p, 0); digits_p -= 3; while (digits_p > digits_start_p) { if (digits_p[-1] != 0) { round_up = true; break; } digits_p--; } } } } if (round_up) { fraction += rounding_bit; fraction >>= (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH); if (fraction == 0) { biased_exp++; } } else { fraction >>= (8 * sizeof (uint64_t) - ECMA_NUMBER_FRACTION_WIDTH); } bool sign = (value_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN); ecma_number_t result; if (biased_exp < (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) { result = ecma_number_pack (sign, biased_exp, fraction); } else { result = ecma_number_make_infinity (sign); } return ecma_make_number_value (result); } /* ecma_bigint_to_number */] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static enum_func_status php_mysqlnd_read_error_from_line(zend_uchar *buf, size_t buf_len, char *error, int error_buf_len, unsigned int *error_no, char *sqlstate TSRMLS_DC) { zend_uchar *p = buf; int error_msg_len= 0; DBG_ENTER("php_mysqlnd_read_error_from_line"); *error_no = CR_UNKNOWN_ERROR; memcpy(sqlstate, unknown_sqlstate, MYSQLND_SQLSTATE_LENGTH); if (buf_len > 2) { *error_no = uint2korr(p); p+= 2; /* sqlstate is following. No need to check for buf_left_len as we checked > 2 above, if it was >=2 then we would need a check */ if (*p == '#') { ++p; if ((buf_len - (p - buf)) >= MYSQLND_SQLSTATE_LENGTH) { memcpy(sqlstate, p, MYSQLND_SQLSTATE_LENGTH); p+= MYSQLND_SQLSTATE_LENGTH; } else { goto end; } } if ((buf_len - (p - buf)) > 0) { error_msg_len = MIN((int)((buf_len - (p - buf))), (int) (error_buf_len - 1)); memcpy(error, p, error_msg_len); } } end: sqlstate[MYSQLND_SQLSTATE_LENGTH] = '\0'; error[error_msg_len]= '\0'; DBG_RETURN(FAIL);] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void test_http_server(void) { struct mg_mgr mgr; const char *url = "http://127.0.0.1:12346"; char buf[FETCH_BUF_SIZE]; mg_mgr_init(&mgr); mg_http_listen(&mgr, url, eh1, NULL); ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hello\n") == 0); ASSERT(fetch(&mgr, buf, url, "GET /%%61.txt HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hello\n") == 0); // Responses with missing reason phrase must also work ASSERT(fetch(&mgr, buf, url, "GET /no_reason HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "ok") == 0); // Fetch file with unicode chars in filename ASSERT(fetch(&mgr, buf, url, "GET /київ.txt HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "є\n") == 0); ASSERT(fetch(&mgr, buf, url, "GET /../fuzz.c HTTP/1.0\n\n") == 404); ASSERT(fetch(&mgr, buf, url, "GET /.%%2e/fuzz.c HTTP/1.0\n\n") == 404); ASSERT(fetch(&mgr, buf, url, "GET /.%%2e%%2ffuzz.c HTTP/1.0\n\n") == 404); ASSERT(fetch(&mgr, buf, url, "GET /..%%2f%%20fuzz.c HTTP/1.0\n\n") == 404); ASSERT(fetch(&mgr, buf, url, "GET /..%%2ffuzz.c%%20 HTTP/1.0\n\n") == 404); ASSERT(fetch(&mgr, buf, url, "GET /dredir HTTP/1.0\n\n") == 301); ASSERT(cmpheader(buf, "Location", "/dredir/")); ASSERT(fetch(&mgr, buf, url, "GET /dredir/ HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hi\n") == 0); ASSERT(fetch(&mgr, buf, url, "GET /..ddot HTTP/1.0\n\n") == 301); ASSERT(fetch(&mgr, buf, url, "GET /..ddot/ HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hi\n") == 0); { extern char *mg_http_etag(char *, size_t, size_t, time_t); char etag[100]; size_t size = 0; time_t mtime = 0; ASSERT(mg_fs_posix.stat("./test/data/a.txt", &size, &mtime) != 0); ASSERT(mg_http_etag(etag, sizeof(etag), size, mtime) == etag); ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\nIf-None-Match: %s\n\n", etag) == 304); } // Text mime type override ASSERT(fetch(&mgr, buf, url, "GET /servefile HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hello\n") == 0); { struct mg_http_message hm; mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_http_get_header(&hm, "Content-Type") != NULL); ASSERT(mg_strcmp(*mg_http_get_header(&hm, "Content-Type"), mg_str("c/d")) == 0); } ASSERT(fetch(&mgr, buf, url, "GET /foo/1 HTTP/1.0\r\n\n") == 200); // LOG(LL_INFO, ("%d %.*s", (int) hm.len, (int) hm.len, hm.buf)); ASSERT(cmpbody(buf, "uri: 1") == 0); ASSERT(fetch(&mgr, buf, url, "%s", "POST /body HTTP/1.1\r\n" "Content-Length: 4\r\n\r\nkuku") == 200); ASSERT(cmpbody(buf, "kuku") == 0); ASSERT(fetch(&mgr, buf, url, "GET /ssi HTTP/1.1\r\n\r\n") == 301); ASSERT(fetch(&mgr, buf, url, "GET /ssi/ HTTP/1.1\r\n\r\n") == 200); ASSERT(cmpbody(buf, "this is index\n" "this is nested\n\n" "this is f1\n\n\n\n" "recurse\n\n" "recurse\n\n" "recurse\n\n" "recurse\n\n" "recurse\n\n") == 0); { struct mg_http_message hm; mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_http_get_header(&hm, "Content-Length") != NULL); ASSERT(mg_http_get_header(&hm, "Content-Type") != NULL); ASSERT(mg_strcmp(*mg_http_get_header(&hm, "Content-Type"), mg_str("text/html; charset=utf-8")) == 0); } ASSERT(fetch(&mgr, buf, url, "GET /badroot HTTP/1.0\r\n\n") == 400); ASSERT(cmpbody(buf, "Invalid web root [/BAAADDD!]\n") == 0); { char *data = mg_file_read("./test/data/ca.pem", NULL); ASSERT(fetch(&mgr, buf, url, "GET /ca.pem HTTP/1.0\r\n\n") == 200); ASSERT(cmpbody(buf, data) == 0); free(data); } { // Test mime type struct mg_http_message hm; ASSERT(fetch(&mgr, buf, url, "GET /empty.js HTTP/1.0\r\n\n") == 200); mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_http_get_header(&hm, "Content-Type") != NULL); ASSERT(mg_strcmp(*mg_http_get_header(&hm, "Content-Type"), mg_str("text/javascript; charset=utf-8")) == 0); } { // Test connection refused int i, errored = 0; mg_connect(&mgr, "tcp://127.0.0.1:55117", eh9, &errored); for (i = 0; i < 10 && errored == 0; i++) mg_mgr_poll(&mgr, 1); ASSERT(errored == 7); } // Directory listing fetch(&mgr, buf, url, "GET /test/ HTTP/1.0\n\n"); ASSERT(fetch(&mgr, buf, url, "GET /test/ HTTP/1.0\n\n") == 200); ASSERT(mg_strstr(mg_str(buf), mg_str(">Index of /test/<")) != NULL); ASSERT(mg_strstr(mg_str(buf), mg_str(">fuzz.c<")) != NULL); { // Credentials struct mg_http_message hm; ASSERT(fetch(&mgr, buf, url, "%s", "GET /creds?access_token=x HTTP/1.0\r\n\r\n") == 200); mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_strcmp(hm.body, mg_str("[]:[x]")) == 0); ASSERT(fetch(&mgr, buf, url, "%s", "GET /creds HTTP/1.0\r\n" "Authorization: Bearer x\r\n\r\n") == 200); mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_strcmp(hm.body, mg_str("[]:[x]")) == 0); ASSERT(fetch(&mgr, buf, url, "%s", "GET /creds HTTP/1.0\r\n" "Authorization: Basic Zm9vOmJhcg==\r\n\r\n") == 200); mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_strcmp(hm.body, mg_str("[foo]:[bar]")) == 0); ASSERT(fetch(&mgr, buf, url, "%s", "GET /creds HTTP/1.0\r\n" "Cookie: blah; access_token=hello\r\n\r\n") == 200); mg_http_parse(buf, strlen(buf), &hm); ASSERT(mg_strcmp(hm.body, mg_str("[]:[hello]")) == 0); } { // Test upload char *p; remove("uploaded.txt"); ASSERT((p = mg_file_read("uploaded.txt", NULL)) == NULL); ASSERT(fetch(&mgr, buf, url, "POST /upload HTTP/1.0\n" "Content-Length: 1\n\nx") == 400); ASSERT(fetch(&mgr, buf, url, "POST /upload?name=uploaded.txt HTTP/1.0\r\n" "Content-Length: 5\r\n" "\r\nhello") == 200); ASSERT(fetch(&mgr, buf, url, "POST /upload?name=uploaded.txt&offset=5 HTTP/1.0\r\n" "Content-Length: 6\r\n" "\r\n\nworld") == 200); ASSERT((p = mg_file_read("uploaded.txt", NULL)) != NULL); ASSERT(strcmp(p, "hello\nworld") == 0); free(p); remove("uploaded.txt"); } // HEAD request ASSERT(fetch(&mgr, buf, url, "GET /a.txt HTTP/1.0\n\n") == 200); ASSERT(fetch(&mgr, buf, url, "HEAD /a.txt HTTP/1.0\n\n") == 200); #if MG_ENABLE_IPV6 { const char *url6 = "http://[::1]:12346"; ASSERT(mg_http_listen(&mgr, url6, eh1, NULL) != NULL); ASSERT(fetch(&mgr, buf, url6, "GET /a.txt HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hello\n") == 0); } #endif mg_mgr_free(&mgr); ASSERT(mgr.conns == NULL); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, bgp_size_t size, struct bgp_nlri *mp_update, struct bgp_nlri *mp_withdraw) { bgp_attr_parse_ret_t ret; uint8_t flag = 0; uint8_t type = 0; bgp_size_t length; uint8_t *startp, *endp; uint8_t *attr_endp; uint8_t seen[BGP_ATTR_BITMAP_SIZE]; /* we need the as4_path only until we have synthesized the as_path with * it */ /* same goes for as4_aggregator */ struct aspath *as4_path = NULL; as_t as4_aggregator = 0; struct in_addr as4_aggregator_addr = {.s_addr = 0}; /* Initialize bitmap. */ memset(seen, 0, BGP_ATTR_BITMAP_SIZE); /* End pointer of BGP attribute. */ endp = BGP_INPUT_PNT(peer) + size; /* Get attributes to the end of attribute length. */ while (BGP_INPUT_PNT(peer) < endp) { /* Check remaining length check.*/ if (endp - BGP_INPUT_PNT(peer) < BGP_ATTR_MIN_LEN) { /* XXX warning: long int format, int arg (arg 5) */ flog_warn( EC_BGP_ATTRIBUTE_TOO_SMALL, "%s: error BGP attribute length %lu is smaller than min len", peer->host, (unsigned long)(endp - stream_pnt(BGP_INPUT(peer)))); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); return BGP_ATTR_PARSE_ERROR; } /* Fetch attribute flag and type. */ startp = BGP_INPUT_PNT(peer); /* "The lower-order four bits of the Attribute Flags octet are unused. They MUST be zero when sent and MUST be ignored when received." */ flag = 0xF0 & stream_getc(BGP_INPUT(peer)); type = stream_getc(BGP_INPUT(peer)); /* Check whether Extended-Length applies and is in bounds */ if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN) && ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) { flog_warn( EC_BGP_EXT_ATTRIBUTE_TOO_SMALL, "%s: Extended length set, but just %lu bytes of attr header", peer->host, (unsigned long)(endp - stream_pnt(BGP_INPUT(peer)))); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); return BGP_ATTR_PARSE_ERROR; } /* Check extended attribue length bit. */ if (CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN)) length = stream_getw(BGP_INPUT(peer)); else length = stream_getc(BGP_INPUT(peer)); /* If any attribute appears more than once in the UPDATE message, then the Error Subcode is set to Malformed Attribute List. */ if (CHECK_BITMAP(seen, type)) { flog_warn( EC_BGP_ATTRIBUTE_REPEATED, "%s: error BGP attribute type %d appears twice in a message", peer->host, type); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); return BGP_ATTR_PARSE_ERROR; } /* Set type to bitmap to check duplicate attribute. `type' is unsigned char so it never overflow bitmap range. */ SET_BITMAP(seen, type); /* Overflow check. */ attr_endp = BGP_INPUT_PNT(peer) + length; if (attr_endp > endp) { flog_warn( EC_BGP_ATTRIBUTE_TOO_LARGE, "%s: BGP type %d length %d is too large, attribute total length is %d. attr_endp is %p. endp is %p", peer->host, type, length, size, attr_endp, endp); /* * RFC 4271 6.3 * If any recognized attribute has an Attribute * Length that conflicts with the expected length * (based on the attribute type code), then the * Error Subcode MUST be set to Attribute Length * Error. The Data field MUST contain the erroneous * attribute (type, length, and value). * ---------- * We do not currently have a good way to determine the * length of the attribute independent of the length * received in the message. Instead we send the * minimum between the amount of data we have and the * amount specified by the attribute length field. * * Instead of directly passing in the packet buffer and * offset we use the stream_get* functions to read into * a stack buffer, since they perform bounds checking * and we are working with untrusted data. */ unsigned char ndata[BGP_MAX_PACKET_SIZE]; memset(ndata, 0x00, sizeof(ndata)); size_t lfl = CHECK_FLAG(flag, BGP_ATTR_FLAG_EXTLEN) ? 2 : 1; /* Rewind to end of flag field */ stream_forward_getp(BGP_INPUT(peer), -(1 + lfl)); /* Type */ stream_get(&ndata[0], BGP_INPUT(peer), 1); /* Length */ stream_get(&ndata[1], BGP_INPUT(peer), lfl); /* Value */ size_t atl = attr_endp - startp; size_t ndl = MIN(atl, STREAM_READABLE(BGP_INPUT(peer))); stream_get(&ndata[lfl + 1], BGP_INPUT(peer), ndl); bgp_notify_send_with_data( peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, ndata, ndl + lfl + 1); return BGP_ATTR_PARSE_ERROR; } struct bgp_attr_parser_args attr_args = { .peer = peer, .length = length, .attr = attr, .type = type, .flags = flag, .startp = startp, .total = attr_endp - startp, }; /* If any recognized attribute has Attribute Flags that conflict with the Attribute Type Code, then the Error Subcode is set to Attribute Flags Error. The Data field contains the erroneous attribute (type, length and value). */ if (bgp_attr_flag_invalid(&attr_args)) { ret = bgp_attr_malformed( &attr_args, BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, attr_args.total); if (ret == BGP_ATTR_PARSE_PROCEED) continue; return ret; } /* OK check attribute and store it's value. */ switch (type) { case BGP_ATTR_ORIGIN: ret = bgp_attr_origin(&attr_args); break; case BGP_ATTR_AS_PATH: ret = bgp_attr_aspath(&attr_args); break; case BGP_ATTR_AS4_PATH: ret = bgp_attr_as4_path(&attr_args, &as4_path); break; case BGP_ATTR_NEXT_HOP: ret = bgp_attr_nexthop(&attr_args); break; case BGP_ATTR_MULTI_EXIT_DISC: ret = bgp_attr_med(&attr_args); break; case BGP_ATTR_LOCAL_PREF: ret = bgp_attr_local_pref(&attr_args); break; case BGP_ATTR_ATOMIC_AGGREGATE: ret = bgp_attr_atomic(&attr_args); break; case BGP_ATTR_AGGREGATOR: ret = bgp_attr_aggregator(&attr_args); break; case BGP_ATTR_AS4_AGGREGATOR: ret = bgp_attr_as4_aggregator(&attr_args, &as4_aggregator, &as4_aggregator_addr); break; case BGP_ATTR_COMMUNITIES: ret = bgp_attr_community(&attr_args); break; case BGP_ATTR_LARGE_COMMUNITIES: ret = bgp_attr_large_community(&attr_args); break; case BGP_ATTR_ORIGINATOR_ID: ret = bgp_attr_originator_id(&attr_args); break; case BGP_ATTR_CLUSTER_LIST: ret = bgp_attr_cluster_list(&attr_args); break; case BGP_ATTR_MP_REACH_NLRI: ret = bgp_mp_reach_parse(&attr_args, mp_update); break; case BGP_ATTR_MP_UNREACH_NLRI: ret = bgp_mp_unreach_parse(&attr_args, mp_withdraw); break; case BGP_ATTR_EXT_COMMUNITIES: ret = bgp_attr_ext_communities(&attr_args); break; #if ENABLE_BGP_VNC case BGP_ATTR_VNC: #endif case BGP_ATTR_ENCAP: ret = bgp_attr_encap(type, peer, length, attr, flag, startp); break; case BGP_ATTR_PREFIX_SID: ret = bgp_attr_prefix_sid(length, &attr_args, mp_update); break; case BGP_ATTR_PMSI_TUNNEL: ret = bgp_attr_pmsi_tunnel(&attr_args); break; default: ret = bgp_attr_unknown(&attr_args); break; } if (ret == BGP_ATTR_PARSE_ERROR_NOTIFYPLS) { bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); ret = BGP_ATTR_PARSE_ERROR; } if (ret == BGP_ATTR_PARSE_EOR) { if (as4_path) aspath_unintern(&as4_path); return ret; } /* If hard error occurred immediately return to the caller. */ if (ret == BGP_ATTR_PARSE_ERROR) { flog_warn(EC_BGP_ATTRIBUTE_PARSE_ERROR, "%s: Attribute %s, parse error", peer->host, lookup_msg(attr_str, type, NULL)); if (as4_path) aspath_unintern(&as4_path); return ret; } if (ret == BGP_ATTR_PARSE_WITHDRAW) { flog_warn( EC_BGP_ATTRIBUTE_PARSE_WITHDRAW, "%s: Attribute %s, parse error - treating as withdrawal", peer->host, lookup_msg(attr_str, type, NULL)); if (as4_path) aspath_unintern(&as4_path); return ret; } /* Check the fetched length. */ if (BGP_INPUT_PNT(peer) != attr_endp) { flog_warn(EC_BGP_ATTRIBUTE_FETCH_ERROR, "%s: BGP attribute %s, fetch error", peer->host, lookup_msg(attr_str, type, NULL)); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); if (as4_path) aspath_unintern(&as4_path); return BGP_ATTR_PARSE_ERROR; } } /* Check final read pointer is same as end pointer. */ if (BGP_INPUT_PNT(peer) != endp) { flog_warn(EC_BGP_ATTRIBUTES_MISMATCH, "%s: BGP attribute %s, length mismatch", peer->host, lookup_msg(attr_str, type, NULL)); bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR); if (as4_path) aspath_unintern(&as4_path); return BGP_ATTR_PARSE_ERROR; } /* Check all mandatory well-known attributes are present */ if ((ret = bgp_attr_check(peer, attr)) < 0) { if (as4_path) aspath_unintern(&as4_path); return ret; } /* * At this place we can see whether we got AS4_PATH and/or * AS4_AGGREGATOR from a 16Bit peer and act accordingly. * We can not do this before we've read all attributes because * the as4 handling does not say whether AS4_PATH has to be sent * after AS_PATH or not - and when AS4_AGGREGATOR will be send * in relationship to AGGREGATOR. * So, to be defensive, we are not relying on any order and read * all attributes first, including these 32bit ones, and now, * afterwards, we look what and if something is to be done for as4. * * It is possible to not have AS_PATH, e.g. GR EoR and sole * MP_UNREACH_NLRI. */ /* actually... this doesn't ever return failure currently, but * better safe than sorry */ if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH)) && bgp_attr_munge_as4_attrs(peer, attr, as4_path, as4_aggregator, &as4_aggregator_addr)) { bgp_notify_send(peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_MAL_ATTR); if (as4_path) aspath_unintern(&as4_path); return BGP_ATTR_PARSE_ERROR; } /* At this stage, we have done all fiddling with as4, and the * resulting info is in attr->aggregator resp. attr->aspath * so we can chuck as4_aggregator and as4_path alltogether in * order to save memory */ if (as4_path) { aspath_unintern(&as4_path); /* unintern - it is in the hash */ /* The flag that we got this is still there, but that does not * do any trouble */ } /* * The "rest" of the code does nothing with as4_aggregator. * there is no memory attached specifically which is not part * of the attr. * so ignoring just means do nothing. */ /* * Finally do the checks on the aspath we did not do yet * because we waited for a potentially synthesized aspath. */ if (attr->flag & (ATTR_FLAG_BIT(BGP_ATTR_AS_PATH))) { ret = bgp_attr_aspath_check(peer, attr); if (ret != BGP_ATTR_PARSE_PROCEED) return ret; } /* Finally intern unknown attribute. */ if (attr->transit) attr->transit = transit_intern(attr->transit); if (attr->encap_subtlvs) attr->encap_subtlvs = encap_intern(attr->encap_subtlvs, ENCAP_SUBTLV_TYPE); #if ENABLE_BGP_VNC if (attr->vnc_subtlvs) attr->vnc_subtlvs = encap_intern(attr->vnc_subtlvs, VNC_SUBTLV_TYPE); #endif return BGP_ATTR_PARSE_PROCEED; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void vmx_update_msr_bitmap_x2apic(struct kvm_vcpu *vcpu, u8 mode) { if (!cpu_has_vmx_msr_bitmap()) return; vmx_reset_x2apic_msrs(vcpu, mode); /* * TPR reads and writes can be virtualized even if virtual interrupt * delivery is not in use. */ vmx_set_intercept_for_msr(vcpu, X2APIC_MSR(APIC_TASKPRI), MSR_TYPE_RW, !(mode & MSR_BITMAP_MODE_X2APIC)); if (mode & MSR_BITMAP_MODE_X2APIC_APICV) { vmx_enable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_TMCCT), MSR_TYPE_RW); vmx_disable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_EOI), MSR_TYPE_W); vmx_disable_intercept_for_msr(vcpu, X2APIC_MSR(APIC_SELF_IPI), MSR_TYPE_W); } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [u64 vmx_get_l2_tsc_offset(struct kvm_vcpu *vcpu) { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); if (nested_cpu_has(vmcs12, CPU_BASED_USE_TSC_OFFSETTING)) return vmcs12->tsc_offset; return 0; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [const char *nghttp2_strerror(int error_code) { switch (error_code) { case 0: return "Success"; case NGHTTP2_ERR_INVALID_ARGUMENT: return "Invalid argument"; case NGHTTP2_ERR_BUFFER_ERROR: return "Out of buffer space"; case NGHTTP2_ERR_UNSUPPORTED_VERSION: return "Unsupported SPDY version"; case NGHTTP2_ERR_WOULDBLOCK: return "Operation would block"; case NGHTTP2_ERR_PROTO: return "Protocol error"; case NGHTTP2_ERR_INVALID_FRAME: return "Invalid frame octets"; case NGHTTP2_ERR_EOF: return "EOF"; case NGHTTP2_ERR_DEFERRED: return "Data transfer deferred"; case NGHTTP2_ERR_STREAM_ID_NOT_AVAILABLE: return "No more Stream ID available"; case NGHTTP2_ERR_STREAM_CLOSED: return "Stream was already closed or invalid"; case NGHTTP2_ERR_STREAM_CLOSING: return "Stream is closing"; case NGHTTP2_ERR_STREAM_SHUT_WR: return "The transmission is not allowed for this stream"; case NGHTTP2_ERR_INVALID_STREAM_ID: return "Stream ID is invalid"; case NGHTTP2_ERR_INVALID_STREAM_STATE: return "Invalid stream state"; case NGHTTP2_ERR_DEFERRED_DATA_EXIST: return "Another DATA frame has already been deferred"; case NGHTTP2_ERR_START_STREAM_NOT_ALLOWED: return "request HEADERS is not allowed"; case NGHTTP2_ERR_GOAWAY_ALREADY_SENT: return "GOAWAY has already been sent"; case NGHTTP2_ERR_INVALID_HEADER_BLOCK: return "Invalid header block"; case NGHTTP2_ERR_INVALID_STATE: return "Invalid state"; case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE: return "The user callback function failed due to the temporal error"; case NGHTTP2_ERR_FRAME_SIZE_ERROR: return "The length of the frame is invalid"; case NGHTTP2_ERR_HEADER_COMP: return "Header compression/decompression error"; case NGHTTP2_ERR_FLOW_CONTROL: return "Flow control error"; case NGHTTP2_ERR_INSUFF_BUFSIZE: return "Insufficient buffer size given to function"; case NGHTTP2_ERR_PAUSE: return "Callback was paused by the application"; case NGHTTP2_ERR_TOO_MANY_INFLIGHT_SETTINGS: return "Too many inflight SETTINGS"; case NGHTTP2_ERR_PUSH_DISABLED: return "Server push is disabled by peer"; case NGHTTP2_ERR_DATA_EXIST: return "DATA or HEADERS frame has already been submitted for the stream"; case NGHTTP2_ERR_SESSION_CLOSING: return "The current session is closing"; case NGHTTP2_ERR_HTTP_HEADER: return "Invalid HTTP header field was received"; case NGHTTP2_ERR_HTTP_MESSAGING: return "Violation in HTTP messaging rule"; case NGHTTP2_ERR_REFUSED_STREAM: return "Stream was refused"; case NGHTTP2_ERR_INTERNAL: return "Internal error"; case NGHTTP2_ERR_CANCEL: return "Cancel"; case NGHTTP2_ERR_SETTINGS_EXPECTED: return "When a local endpoint expects to receive SETTINGS frame, it " "receives an other type of frame"; case NGHTTP2_ERR_NOMEM: return "Out of memory"; case NGHTTP2_ERR_CALLBACK_FAILURE: return "The user callback function failed"; case NGHTTP2_ERR_BAD_CLIENT_MAGIC: return "Received bad client magic byte string"; case NGHTTP2_ERR_FLOODED: return "Flooding was detected in this HTTP/2 session, and it must be " "closed"; default: return "Unknown error code"; } }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int connection_handle_write(request_st * const r, connection * const con) { /*assert(!chunkqueue_is_empty(cq));*//* checked by callers */ if (con->is_writable <= 0) return CON_STATE_WRITE; int rc = connection_write_chunkqueue(con, con->write_queue, MAX_WRITE_LIMIT); switch (rc) { case 0: if (r->resp_body_finished) { connection_set_state(r, CON_STATE_RESPONSE_END); return CON_STATE_RESPONSE_END; } break; case -1: /* error on our side */ log_error(r->conf.errh, __FILE__, __LINE__, "connection closed: write failed on fd %d", con->fd); connection_set_state_error(r, CON_STATE_ERROR); return CON_STATE_ERROR; case -2: /* remote close */ connection_set_state_error(r, CON_STATE_ERROR); return CON_STATE_ERROR; case 1: /* do not spin trying to send HTTP/2 server Connection Preface * while waiting for TLS negotiation to complete */ if (con->write_queue->bytes_out) con->is_writable = 0; /* not finished yet -> WRITE */ break; } return CON_STATE_WRITE; /*(state did not change)*/ }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ void startPreloader() { TRACE_POINT(); this_thread::disable_interruption di; this_thread::disable_syscall_interruption dsi; assert(!preloaderStarted()); checkChrootDirectories(options); shared_array<const char *> args; vector<string> command = createRealPreloaderCommand(options, args); SpawnPreparationInfo preparation = prepareSpawn(options); SocketPair adminSocket = createUnixSocketPair(); Pipe errorPipe = createPipe(); DebugDirPtr debugDir = make_shared<DebugDir>(preparation.uid, preparation.gid); pid_t pid; pid = syscalls::fork(); if (pid == 0) { setenv("PASSENGER_DEBUG_DIR", debugDir->getPath().c_str(), 1); purgeStdio(stdout); purgeStdio(stderr); resetSignalHandlersAndMask(); disableMallocDebugging(); int adminSocketCopy = dup2(adminSocket.first, 3); int errorPipeCopy = dup2(errorPipe.second, 4); dup2(adminSocketCopy, 0); dup2(adminSocketCopy, 1); dup2(errorPipeCopy, 2); closeAllFileDescriptors(2); setChroot(preparation); switchUser(preparation); setWorkingDirectory(preparation); execvp(command[0].c_str(), (char * const *) args.get()); int e = errno; printf("!> Error\n"); printf("!> \n"); printf("Cannot execute \"%s\": %s (errno=%d)\n", command[0].c_str(), strerror(e), e); fprintf(stderr, "Cannot execute \"%s\": %s (errno=%d)\n", command[0].c_str(), strerror(e), e); fflush(stdout); fflush(stderr); _exit(1); } else if (pid == -1) { int e = errno; throw SystemException("Cannot fork a new process", e); } else { ScopeGuard guard(boost::bind(nonInterruptableKillAndWaitpid, pid)); adminSocket.first.close(); errorPipe.second.close(); StartupDetails details; details.adminSocket = adminSocket.second; details.io = BufferedIO(adminSocket.second); details.stderrCapturer = make_shared<BackgroundIOCapturer>( errorPipe.first, config->forwardStderr ? config->forwardStderrTo : -1); details.stderrCapturer->start(); details.debugDir = debugDir; details.options = &options; details.timeout = options.startTimeout * 1000; details.forwardStderr = config->forwardStderr; details.forwardStderrTo = config->forwardStderrTo; { this_thread::restore_interruption ri(di); this_thread::restore_syscall_interruption rsi(dsi); socketAddress = negotiatePreloaderStartup(details); } this->adminSocket = adminSocket.second; { lock_guard<boost::mutex> l(simpleFieldSyncher); this->pid = pid; } preloaderOutputWatcher.set(adminSocket.second, ev::READ); libev->start(preloaderOutputWatcher); setNonBlocking(errorPipe.first); preloaderErrorWatcher = make_shared<PipeWatcher>(libev, errorPipe.first, config->forwardStderr ? config->forwardStderrTo : -1); preloaderErrorWatcher->start(); preloaderAnnotations = debugDir->readAll(); P_DEBUG("Preloader for " << options.appRoot << " started on PID " << pid << ", listening on " << socketAddress); guard.clear(); } }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ uint8_t escaped_char_value( char* text) { char hex[3]; int result; assert(text[0] == '\\'); switch(text[1]) { case 'x': hex[0] = text[2]; hex[1] = text[3]; hex[2] = '\0'; sscanf(hex, "%x", &result); break; case 'n': result = '\n'; break; case 't': result = '\t'; break; case 'r': result = '\r'; break; case 'f': result = '\f'; break; case 'a': result = '\a'; break; default: result = text[1]; } return result;] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [set_ref_in_functions(int copyID) { int todo; hashitem_T *hi = NULL; ufunc_T *fp; todo = (int)func_hashtab.ht_used; for (hi = func_hashtab.ht_array; todo > 0 && !got_int; ++hi) { if (!HASHITEM_EMPTY(hi)) { --todo; fp = HI2UF(hi); if (!func_name_refcount(fp->uf_name) && set_ref_in_func(NULL, fp, copyID)) return TRUE; } } return FALSE; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int ssh_scp_init(ssh_scp scp) { int rc; char execbuffer[1024] = {0}; if (scp == NULL) { return SSH_ERROR; } if (scp->state != SSH_SCP_NEW) { ssh_set_error(scp->session, SSH_FATAL, "ssh_scp_init called under invalid state"); return SSH_ERROR; } SSH_LOG(SSH_LOG_PROTOCOL, "Initializing scp session %s %son location '%s'", scp->mode == SSH_SCP_WRITE?"write":"read", scp->recursive?"recursive ":"", scp->location); scp->channel = ssh_channel_new(scp->session); if (scp->channel == NULL) { scp->state = SSH_SCP_ERROR; return SSH_ERROR; } rc = ssh_channel_open_session(scp->channel); if (rc == SSH_ERROR) { scp->state = SSH_SCP_ERROR; return SSH_ERROR; } if (scp->mode == SSH_SCP_WRITE) { snprintf(execbuffer, sizeof(execbuffer), "scp -t %s %s", scp->recursive ? "-r":"", scp->location); } else { snprintf(execbuffer, sizeof(execbuffer), "scp -f %s %s", scp->recursive ? "-r":"", scp->location); } if (ssh_channel_request_exec(scp->channel, execbuffer) == SSH_ERROR) { scp->state = SSH_SCP_ERROR; return SSH_ERROR; } if (scp->mode == SSH_SCP_WRITE) { rc = ssh_scp_response(scp, NULL); if (rc != 0) { return SSH_ERROR; } } else { ssh_channel_write(scp->channel, "", 1); } if (scp->mode == SSH_SCP_WRITE) { scp->state = SSH_SCP_WRITE_INITED; } else { scp->state = SSH_SCP_READ_INITED; } return SSH_OK; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void ssdp_recv(int sd) { ssize_t len; struct sockaddr sa; socklen_t salen; char buf[MAX_PKT_SIZE]; memset(buf, 0, sizeof(buf)); len = recvfrom(sd, buf, sizeof(buf), MSG_DONTWAIT, &sa, &salen); if (len > 0) { buf[len] = 0; if (sa.sa_family != AF_INET) return; if (strstr(buf, "M-SEARCH *")) { size_t i; char *ptr, *type; struct ifsock *ifs; struct sockaddr_in *sin = (struct sockaddr_in *)&sa; ifs = find_outbound(&sa); if (!ifs) { logit(LOG_DEBUG, "No matching socket for client %s", inet_ntoa(sin->sin_addr)); return; } logit(LOG_DEBUG, "Matching socket for client %s", inet_ntoa(sin->sin_addr)); type = strcasestr(buf, "\r\nST:"); if (!type) { logit(LOG_DEBUG, "No Search Type (ST:) found in M-SEARCH *, assuming " SSDP_ST_ALL); type = SSDP_ST_ALL; send_message(ifs, type, &sa); return; } type = strchr(type, ':'); if (!type) return; type++; while (isspace(*type)) type++; ptr = strstr(type, "\r\n"); if (!ptr) return; *ptr = 0; for (i = 0; supported_types[i]; i++) { if (!strcmp(supported_types[i], type)) { logit(LOG_DEBUG, "M-SEARCH * ST: %s from %s port %d", type, inet_ntoa(sin->sin_addr), ntohs(sin->sin_port)); send_message(ifs, type, &sa); return; } } logit(LOG_DEBUG, "M-SEARCH * for unsupported ST: %s from %s", type, inet_ntoa(sin->sin_addr)); } } }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ void DoRealForwardFFT(OpKernelContext* ctx, uint64* fft_shape, const Tensor& in, Tensor* out) { // Create the axes (which are always trailing). const auto axes = Eigen::ArrayXi::LinSpaced(FFTRank, 1, FFTRank); auto device = ctx->eigen_device<CPUDevice>(); auto input = Tensor(in).flat_inner_dims<RealT, FFTRank + 1>(); const auto input_dims = input.dimensions(); // Slice input to fft_shape on its inner-most dimensions. Eigen::DSizes<Eigen::DenseIndex, FFTRank + 1> input_slice_sizes; input_slice_sizes[0] = input_dims[0]; TensorShape temp_shape{input_dims[0]}; for (int i = 1; i <= FFTRank; ++i) { input_slice_sizes[i] = fft_shape[i - 1]; temp_shape.AddDim(fft_shape[i - 1]); } OP_REQUIRES(ctx, temp_shape.num_elements() > 0, errors::InvalidArgument("Obtained a FFT shape of 0 elements: ", temp_shape.DebugString())); auto output = out->flat_inner_dims<ComplexT, FFTRank + 1>(); const Eigen::DSizes<Eigen::DenseIndex, FFTRank + 1> zero_start_indices; // Compute the full FFT using a temporary tensor. Tensor temp; OP_REQUIRES_OK(ctx, ctx->allocate_temp(DataTypeToEnum<ComplexT>::v(), temp_shape, &temp)); auto full_fft = temp.flat_inner_dims<ComplexT, FFTRank + 1>(); full_fft.device(device) = input.slice(zero_start_indices, input_slice_sizes) .template fft<Eigen::BothParts, Eigen::FFT_FORWARD>(axes); // Slice away the negative frequency components. output.device(device) = full_fft.slice(zero_start_indices, output.dimensions()); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [MYSQL_FIELD * unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, my_bool default_value, uint server_capabilities) { MYSQL_ROWS *row; MYSQL_FIELD *field,*result; ulong lengths[9]; /* Max of fields */ DBUG_ENTER("unpack_fields"); field= result= (MYSQL_FIELD*) alloc_root(alloc, (uint) sizeof(*field)*fields); if (!result) { free_rows(data); /* Free old data */ set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate); DBUG_RETURN(0); } bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields); if (server_capabilities & CLIENT_PROTOCOL_41) { /* server is 4.1, and returns the new field result format */ for (row=data->data; row ; row = row->next,field++) { uchar *pos; /* fields count may be wrong */ DBUG_ASSERT((uint) (field - result) < fields); cli_fetch_lengths(&lengths[0], row->data, default_value ? 8 : 7); field->catalog= strmake_root(alloc,(char*) row->data[0], lengths[0]); field->db= strmake_root(alloc,(char*) row->data[1], lengths[1]); field->table= strmake_root(alloc,(char*) row->data[2], lengths[2]); field->org_table= strmake_root(alloc,(char*) row->data[3], lengths[3]); field->name= strmake_root(alloc,(char*) row->data[4], lengths[4]); field->org_name= strmake_root(alloc,(char*) row->data[5], lengths[5]); field->catalog_length= lengths[0]; field->db_length= lengths[1]; field->table_length= lengths[2]; field->org_table_length= lengths[3]; field->name_length= lengths[4]; field->org_name_length= lengths[5]; /* Unpack fixed length parts */ if (lengths[6] != 12) { /* malformed packet. signal an error. */ free_rows(data); /* Free old data */ set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); DBUG_RETURN(0); } pos= (uchar*) row->data[6]; field->charsetnr= uint2korr(pos); field->length= (uint) uint4korr(pos+2); field->type= (enum enum_field_types) pos[6]; field->flags= uint2korr(pos+7); field->decimals= (uint) pos[9]; if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[7]) { field->def=strmake_root(alloc,(char*) row->data[7], lengths[7]); field->def_length= lengths[7]; } else field->def=0; field->max_length= 0; } } #ifndef DELETE_SUPPORT_OF_4_0_PROTOCOL else { /* old protocol, for backward compatibility */ for (row=data->data; row ; row = row->next,field++) { cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); field->name= strdup_root(alloc,(char*) row->data[1]); field->length= (uint) uint3korr(row->data[2]); field->type= (enum enum_field_types) (uchar) row->data[3][0]; field->catalog=(char*) ""; field->db= (char*) ""; field->catalog_length= 0; field->db_length= 0; field->org_table_length= field->table_length= lengths[0]; field->name_length= lengths[1]; if (server_capabilities & CLIENT_LONG_FLAG) { field->flags= uint2korr(row->data[4]); field->decimals=(uint) (uchar) row->data[4][2]; } else { field->flags= (uint) (uchar) row->data[4][0]; field->decimals=(uint) (uchar) row->data[4][1]; } if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[5]) { field->def=strdup_root(alloc,(char*) row->data[5]); field->def_length= lengths[5]; } else field->def=0; field->max_length= 0; } } #endif /* DELETE_SUPPORT_OF_4_0_PROTOCOL */ free_rows(data); /* Free old data */ DBUG_RETURN(result);] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int main(int argc, char **argv) { swaylock_log_init(LOG_ERROR); initialize_pw_backend(argc, argv); srand(time(NULL)); enum line_mode line_mode = LM_LINE; state.failed_attempts = 0; state.args = (struct swaylock_args){ .mode = BACKGROUND_MODE_FILL, .font = strdup("sans-serif"), .font_size = 0, .radius = 50, .thickness = 10, .indicator_x_position = 0, .indicator_y_position = 0, .override_indicator_x_position = false, .override_indicator_y_position = false, .ignore_empty = false, .show_indicator = true, .show_caps_lock_indicator = false, .show_caps_lock_text = true, .show_keyboard_layout = false, .hide_keyboard_layout = false, .show_failed_attempts = false, .indicator_idle_visible = false }; wl_list_init(&state.images); set_default_colors(&state.args.colors); char *config_path = NULL; int result = parse_options(argc, argv, NULL, NULL, &config_path); if (result != 0) { free(config_path); return result; } if (!config_path) { config_path = get_config_path(); } if (config_path) { swaylock_log(LOG_DEBUG, "Found config at %s", config_path); int config_status = load_config(config_path, &state, &line_mode); free(config_path); if (config_status != 0) { free(state.args.font); return config_status; } } if (argc > 1) { swaylock_log(LOG_DEBUG, "Parsing CLI Args"); int result = parse_options(argc, argv, &state, &line_mode, NULL); if (result != 0) { free(state.args.font); return result; } } if (line_mode == LM_INSIDE) { state.args.colors.line = state.args.colors.inside; } else if (line_mode == LM_RING) { state.args.colors.line = state.args.colors.ring; } #ifdef __linux__ // Most non-linux platforms require root to mlock() if (mlock(state.password.buffer, sizeof(state.password.buffer)) != 0) { swaylock_log(LOG_ERROR, "Unable to mlock() password memory."); return EXIT_FAILURE; } #endif wl_list_init(&state.surfaces); state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); state.display = wl_display_connect(NULL); if (!state.display) { free(state.args.font); swaylock_log(LOG_ERROR, "Unable to connect to the compositor. " "If your compositor is running, check or set the " "WAYLAND_DISPLAY environment variable."); return EXIT_FAILURE; } struct wl_registry *registry = wl_display_get_registry(state.display); wl_registry_add_listener(registry, &registry_listener, &state); wl_display_roundtrip(state.display); assert(state.compositor && state.layer_shell && state.shm); if (!state.input_inhibit_manager) { free(state.args.font); swaylock_log(LOG_ERROR, "Compositor does not support the input " "inhibitor protocol, refusing to run insecurely"); return 1; } zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager); if (wl_display_roundtrip(state.display) == -1) { free(state.args.font); swaylock_log(LOG_ERROR, "Exiting - failed to inhibit input:" " is another lockscreen already running?"); return 2; } if (state.zxdg_output_manager) { struct swaylock_surface *surface; wl_list_for_each(surface, &state.surfaces, link) { surface->xdg_output = zxdg_output_manager_v1_get_xdg_output( state.zxdg_output_manager, surface->output); zxdg_output_v1_add_listener( surface->xdg_output, &_xdg_output_listener, surface); } wl_display_roundtrip(state.display); } else { swaylock_log(LOG_INFO, "Compositor does not support zxdg output " "manager, images assigned to named outputs will not work"); } struct swaylock_surface *surface; wl_list_for_each(surface, &state.surfaces, link) { create_layer_surface(surface); } if (state.args.daemonize) { wl_display_roundtrip(state.display); daemonize(); } state.eventloop = loop_create(); loop_add_fd(state.eventloop, wl_display_get_fd(state.display), POLLIN, display_in, NULL); loop_add_fd(state.eventloop, get_comm_reply_fd(), POLLIN, comm_in, NULL); state.run_display = true; while (state.run_display) { errno = 0; if (wl_display_flush(state.display) == -1 && errno != EAGAIN) { break; } loop_poll(state.eventloop); } free(state.args.font); return 0; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ecma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */ { const lit_utf8_size_t string_size = ecma_string_get_size (string_p); const lit_utf8_size_t initial_size = string_size + ECMA_ASCII_STRING_HEADER_SIZE; ecma_stringbuilder_header_t *header_p = (ecma_stringbuilder_header_t *) jmem_heap_alloc_block (initial_size); header_p->current_size = initial_size; #if JERRY_MEM_STATS jmem_stats_allocate_string_bytes (initial_size); #endif /* JERRY_MEM_STATS */ size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p, ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size); JERRY_ASSERT (copied_size == string_size); ecma_stringbuilder_t ret = {.header_p = header_p}; return ret; } /* ecma_stringbuilder_create_from */] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ UnknownRecordContent(const string& zone) : DNSRecordContent(0) { d_record.insert(d_record.end(), zone.begin(), zone.end()); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [lseg_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); LSEG *lseg; lseg = (LSEG *) palloc(sizeof(LSEG)); lseg->p[0].x = pq_getmsgfloat8(buf); lseg->p[0].y = pq_getmsgfloat8(buf); lseg->p[1].x = pq_getmsgfloat8(buf); lseg->p[1].y = pq_getmsgfloat8(buf); #ifdef NOT_USED lseg->m = point_sl(&lseg->p[0], &lseg->p[1]); #endif PG_RETURN_LSEG_P(lseg); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int jpc_dec_process_sot(jpc_dec_t *dec, jpc_ms_t *ms) { jpc_dec_tile_t *tile; jpc_sot_t *sot = &ms->parms.sot; jas_image_cmptparm_t *compinfos; jas_image_cmptparm_t *compinfo; jpc_dec_cmpt_t *cmpt; int cmptno; if (dec->state == JPC_MH) { compinfos = jas_malloc(dec->numcomps * sizeof(jas_image_cmptparm_t)); assert(compinfos); for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos; cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) { compinfo->tlx = 0; compinfo->tly = 0; compinfo->prec = cmpt->prec; compinfo->sgnd = cmpt->sgnd; compinfo->width = cmpt->width; compinfo->height = cmpt->height; compinfo->hstep = cmpt->hstep; compinfo->vstep = cmpt->vstep; } if (!(dec->image = jas_image_create(dec->numcomps, compinfos, JAS_CLRSPC_UNKNOWN))) { return -1; } jas_free(compinfos); /* Is the packet header information stored in PPM marker segments in the main header? */ if (dec->ppmstab) { /* Convert the PPM marker segment data into a collection of streams (one stream per tile-part). */ if (!(dec->pkthdrstreams = jpc_ppmstabtostreams(dec->ppmstab))) { abort(); } jpc_ppxstab_destroy(dec->ppmstab); dec->ppmstab = 0; } } if (sot->len > 0) { dec->curtileendoff = jas_stream_getrwcount(dec->in) - ms->len - 4 + sot->len; } else { dec->curtileendoff = 0; } if (JAS_CAST(int, sot->tileno) >= dec->numtiles) { jas_eprintf("invalid tile number in SOT marker segment\n"); return -1; } /* Set the current tile. */ dec->curtile = &dec->tiles[sot->tileno]; tile = dec->curtile; /* Ensure that this is the expected part number. */ if (sot->partno != tile->partno) { return -1; } if (tile->numparts > 0 && sot->partno >= tile->numparts) { return -1; } if (!tile->numparts && sot->numparts > 0) { tile->numparts = sot->numparts; } tile->pptstab = 0; switch (tile->state) { case JPC_TILE_INIT: /* This is the first tile-part for this tile. */ tile->state = JPC_TILE_ACTIVE; assert(!tile->cp); if (!(tile->cp = jpc_dec_cp_copy(dec->cp))) { return -1; } jpc_dec_cp_resetflags(dec->cp); break; default: if (sot->numparts == sot->partno - 1) { tile->state = JPC_TILE_ACTIVELAST; } break; } /* Note: We do not increment the expected tile-part number until all processing for this tile-part is complete. */ /* We should expect to encounter other tile-part header marker segments next. */ dec->state = JPC_TPH; return 0; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [hivex_open (const char *filename, int flags) { hive_h *h = NULL; assert (sizeof (struct ntreg_header) == 0x1000); assert (offsetof (struct ntreg_header, csum) == 0x1fc); h = calloc (1, sizeof *h); if (h == NULL) goto error; h->msglvl = flags & HIVEX_OPEN_MSGLVL_MASK; const char *debug = getenv ("HIVEX_DEBUG"); if (debug && STREQ (debug, "1")) h->msglvl = 2; DEBUG (2, "created handle %p", h); h->writable = !!(flags & HIVEX_OPEN_WRITE); h->unsafe = !!(flags & HIVEX_OPEN_UNSAFE); h->filename = strdup (filename); if (h->filename == NULL) goto error; #ifdef O_CLOEXEC h->fd = open (filename, O_RDONLY | O_CLOEXEC | O_BINARY); #else h->fd = open (filename, O_RDONLY | O_BINARY); #endif if (h->fd == -1) goto error; #ifndef O_CLOEXEC fcntl (h->fd, F_SETFD, FD_CLOEXEC); #endif struct stat statbuf; if (fstat (h->fd, &statbuf) == -1) goto error; h->size = statbuf.st_size; if (h->size < 0x2000) { SET_ERRNO (EINVAL, "%s: file is too small to be a Windows NT Registry hive file", filename); goto error; } if (!h->writable) { h->addr = mmap (NULL, h->size, PROT_READ, MAP_SHARED, h->fd, 0); if (h->addr == MAP_FAILED) goto error; DEBUG (2, "mapped file at %p", h->addr); } else { h->addr = malloc (h->size); if (h->addr == NULL) goto error; if (full_read (h->fd, h->addr, h->size) < h->size) goto error; /* We don't need the file descriptor along this path, since we * have read all the data. */ if (close (h->fd) == -1) goto error; h->fd = -1; } /* Check header. */ if (h->hdr->magic[0] != 'r' || h->hdr->magic[1] != 'e' || h->hdr->magic[2] != 'g' || h->hdr->magic[3] != 'f') { SET_ERRNO (ENOTSUP, "%s: not a Windows NT Registry hive file", filename); goto error; } /* Check major version. */ uint32_t major_ver = le32toh (h->hdr->major_ver); if (major_ver != 1) { SET_ERRNO (ENOTSUP, "%s: hive file major version %" PRIu32 " (expected 1)", filename, major_ver); goto error; } h->bitmap = calloc (1 + h->size / 32, 1); if (h->bitmap == NULL) goto error; /* Header checksum. */ uint32_t sum = header_checksum (h); if (sum != le32toh (h->hdr->csum)) { SET_ERRNO (EINVAL, "%s: bad checksum in hive header", filename); goto error; } for (int t=0; t<nr_recode_types; t++) { gl_lock_init (h->iconv_cache[t].mutex); h->iconv_cache[t].handle = NULL; } /* Last modified time. */ h->last_modified = le64toh ((int64_t) h->hdr->last_modified); if (h->msglvl >= 2) { char *name = _hivex_recode (h, utf16le_to_utf8, h->hdr->name, 64, NULL); fprintf (stderr, "hivex_open: header fields:\n" " file version %" PRIu32 ".%" PRIu32 "\n" " sequence nos %" PRIu32 " %" PRIu32 "\n" " (sequences nos should match if hive was synched at shutdown)\n" " last modified %" PRIi64 "\n" " (Windows filetime, x 100 ns since 1601-01-01)\n" " original file name %s\n" " (only 32 chars are stored, name is probably truncated)\n" " root offset 0x%x + 0x1000\n" " end of last page 0x%x + 0x1000 (total file size 0x%zx)\n" " checksum 0x%x (calculated 0x%x)\n", major_ver, le32toh (h->hdr->minor_ver), le32toh (h->hdr->sequence1), le32toh (h->hdr->sequence2), h->last_modified, name ? name : "(conversion failed)", le32toh (h->hdr->offset), le32toh (h->hdr->blocks), h->size, le32toh (h->hdr->csum), sum); free (name); } h->rootoffs = le32toh (h->hdr->offset) + 0x1000; h->endpages = le32toh (h->hdr->blocks) + 0x1000; DEBUG (2, "root offset = 0x%zx", h->rootoffs); /* We'll set this flag when we see a block with the root offset (ie. * the root block). */ int seen_root_block = 0, bad_root_block = 0; /* Collect some stats. */ size_t pages = 0; /* Number of hbin pages read. */ size_t smallest_page = SIZE_MAX, largest_page = 0; size_t blocks = 0; /* Total number of blocks found. */ size_t smallest_block = SIZE_MAX, largest_block = 0, blocks_bytes = 0; size_t used_blocks = 0; /* Total number of used blocks found. */ size_t used_size = 0; /* Total size (bytes) of used blocks. */ /* Read the pages and blocks. The aim here is to be robust against * corrupt or malicious registries. So we make sure the loops * always make forward progress. We add the address of each block * we read to a hash table so pointers will only reference the start * of valid blocks. */ size_t off; struct ntreg_hbin_page *page; for (off = 0x1000; off < h->size; off += le32toh (page->page_size)) { if (off >= h->endpages) break; page = (struct ntreg_hbin_page *) ((char *) h->addr + off); if (page->magic[0] != 'h' || page->magic[1] != 'b' || page->magic[2] != 'i' || page->magic[3] != 'n') { if (!h->unsafe) { SET_ERRNO (ENOTSUP, "%s: trailing garbage at end of file " "(at 0x%zx, after %zu pages)", filename, off, pages); goto error; } DEBUG (2, "page not found at expected offset 0x%zx, " "seeking until one is found or EOF is reached", off); int found = 0; while (off < h->size) { off += 0x1000; if (off >= h->endpages) break; page = (struct ntreg_hbin_page *) ((char *) h->addr + off); if (page->magic[0] == 'h' && page->magic[1] == 'b' && page->magic[2] == 'i' && page->magic[3] == 'n') { DEBUG (2, "found next page by seeking at 0x%zx", off); found = 1; break; } } if (!found) { DEBUG (2, "page not found and end of pages section reached"); break; } } size_t page_size = le32toh (page->page_size); DEBUG (2, "page at 0x%zx, size %zu", off, page_size); pages++; if (page_size < smallest_page) smallest_page = page_size; if (page_size > largest_page) largest_page = page_size; if (page_size <= sizeof (struct ntreg_hbin_page) || (page_size & 0x0fff) != 0) { SET_ERRNO (ENOTSUP, "%s: page size %zu at 0x%zx, bad registry", filename, page_size, off); goto error; } if (off + page_size > h->size) { SET_ERRNO (ENOTSUP, "%s: page size %zu at 0x%zx extends beyond end of file, bad registry", filename, page_size, off); goto error; } size_t page_offset = le32toh(page->offset_first) + 0x1000; if (page_offset != off) { SET_ERRNO (ENOTSUP, "%s: declared page offset (0x%zx) does not match computed " "offset (0x%zx), bad registry", filename, page_offset, off); goto error; } /* Read the blocks in this page. */ size_t blkoff; struct ntreg_hbin_block *block; size_t seg_len; for (blkoff = off + 0x20; blkoff < off + page_size; blkoff += seg_len) { blocks++; int is_root = blkoff == h->rootoffs; if (is_root) seen_root_block = 1; block = (struct ntreg_hbin_block *) ((char *) h->addr + blkoff); int used; seg_len = block_len (h, blkoff, &used); /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78665 */ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-overflow" if (seg_len <= 4 || (seg_len & 3) != 0) { #pragma GCC diagnostic pop if (is_root || !h->unsafe) { SET_ERRNO (ENOTSUP, "%s, the block at 0x%zx has invalid size %" PRIu32 ", bad registry", filename, blkoff, le32toh (block->seg_len)); goto error; } else { DEBUG (2, "%s: block at 0x%zx has invalid size %" PRIu32 ", skipping", filename, blkoff, le32toh (block->seg_len)); break; } } if (h->msglvl >= 2) { unsigned char *id = (unsigned char *) block->id; int id0 = id[0], id1 = id[1]; fprintf (stderr, "%s: %s: " "%s block id %d,%d (%c%c) at 0x%zx size %zu%s\n", "hivex", __func__, used ? "used" : "free", id0, id1, c_isprint (id0) ? id0 : '.', c_isprint (id1) ? id1 : '.', blkoff, seg_len, is_root ? " (root)" : ""); } blocks_bytes += seg_len; if (seg_len < smallest_block) smallest_block = seg_len; if (seg_len > largest_block) largest_block = seg_len; if (is_root && !used) bad_root_block = 1; if (used) { used_blocks++; used_size += seg_len; /* Root block must be an nk-block. */ if (is_root && (block->id[0] != 'n' || block->id[1] != 'k')) bad_root_block = 1; /* Note this blkoff is a valid address. */ BITMAP_SET (h->bitmap, blkoff); } } } if (!seen_root_block) { SET_ERRNO (ENOTSUP, "%s: no root block found", filename); goto error; } if (bad_root_block) { SET_ERRNO (ENOTSUP, "%s: bad root block (free or not nk)", filename); goto error; } DEBUG (1, "successfully read Windows Registry hive file:\n" " pages: %zu [sml: %zu, lge: %zu]\n" " blocks: %zu [sml: %zu, avg: %zu, lge: %zu]\n" " blocks used: %zu\n" " bytes used: %zu", pages, smallest_page, largest_page, blocks, smallest_block, blocks_bytes / blocks, largest_block, used_blocks, used_size); return h; error:; int err = errno; if (h) { free (h->bitmap); if (h->addr && h->size && h->addr != MAP_FAILED) { if (!h->writable) munmap (h->addr, h->size); else free (h->addr); } if (h->fd >= 0) close (h->fd); free (h->filename); free (h); } errno = err; return NULL; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [void address_space_stl_le(AddressSpace *as, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { address_space_stl_internal(as, addr, val, attrs, result, DEVICE_LITTLE_ENDIAN); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int tls1_cbc_remove_padding(const SSL* s, SSL3_RECORD *rec, unsigned block_size, unsigned mac_size) { unsigned padding_length, good, to_check, i; const char has_explicit_iv = s->version >= TLS1_1_VERSION || s->version == DTLS1_VERSION; const unsigned overhead = 1 /* padding length byte */ + mac_size + (has_explicit_iv ? block_size : 0); /* These lengths are all public so we can test them in non-constant * time. */ if (overhead > rec->length) return 0; /* We can always safely skip the explicit IV. We check at the beginning * of this function that the record has at least enough space for the * IV, MAC and padding length byte. (These can be checked in * non-constant time because it's all public information.) So, if the * padding was invalid, then we didn't change |rec->length| and this is * safe. If the padding was valid then we know that we have at least * overhead+padding_length bytes of space and so this is still safe * because overhead accounts for the explicit IV. */ if (has_explicit_iv) { rec->data += block_size; rec->input += block_size; rec->length -= block_size; } padding_length = rec->data[rec->length-1]; /* NB: if compression is in operation the first packet may not be of * even length so the padding bug check cannot be performed. This bug * workaround has been around since SSLeay so hopefully it is either * fixed now or no buggy implementation supports compression [steve] */ if ( (s->options&SSL_OP_TLS_BLOCK_PADDING_BUG) && !s->expand) { /* First packet is even in size, so check */ if ((memcmp(s->s3->read_sequence, "\0\0\0\0\0\0\0\0",8) == 0) && !(padding_length & 1)) { s->s3->flags|=TLS1_FLAGS_TLS_PADDING_BUG; } if ((s->s3->flags & TLS1_FLAGS_TLS_PADDING_BUG) && padding_length > 0) { padding_length--; } } if (EVP_CIPHER_flags(s->enc_read_ctx->cipher)&EVP_CIPH_FLAG_AEAD_CIPHER) { /* padding is already verified */ rec->length -= padding_length; return 1; } good = constant_time_ge(rec->length, overhead+padding_length); /* The padding consists of a length byte at the end of the record and * then that many bytes of padding, all with the same value as the * length byte. Thus, with the length byte included, there are i+1 * bytes of padding. * * We can't check just |padding_length+1| bytes because that leaks * decrypted information. Therefore we always have to check the maximum * amount of padding possible. (Again, the length of the record is * public information so we can use it.) */ to_check = 255; /* maximum amount of padding. */ if (to_check > rec->length-1) to_check = rec->length-1; for (i = 0; i < to_check; i++) { unsigned char mask = constant_time_ge(padding_length, i); unsigned char b = rec->data[rec->length-1-i]; /* The final |padding_length+1| bytes should all have the value * |padding_length|. Therefore the XOR should be zero. */ good &= ~(mask&(padding_length ^ b)); } /* If any of the final |padding_length+1| bytes had the wrong value, * one or more of the lower eight bits of |good| will be cleared. We * AND the bottom 8 bits together and duplicate the result to all the * bits. */ good &= good >> 4; good &= good >> 2; good &= good >> 1; good <<= sizeof(good)*8-1; good = DUPLICATE_MSB_TO_ALL(good); padding_length = good & (padding_length+1); rec->length -= padding_length; rec->type |= padding_length<<8; /* kludge: pass padding length */ return (int)((good & 1) | (~good & -1)); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [archive_string_normalize_C(struct archive_string *as, const void *_p, size_t len, struct archive_string_conv *sc) { const char *s = (const char *)_p; char *p, *endp; uint32_t uc, uc2; size_t w; int always_replace, n, n2, ret = 0, spair, ts, tm; int (*parse)(uint32_t *, const char *, size_t); size_t (*unparse)(char *, size_t, uint32_t); always_replace = 1; ts = 1;/* text size. */ if (sc->flag & SCONV_TO_UTF16BE) { unparse = unicode_to_utf16be; ts = 2; if (sc->flag & SCONV_FROM_UTF16BE) always_replace = 0; } else if (sc->flag & SCONV_TO_UTF16LE) { unparse = unicode_to_utf16le; ts = 2; if (sc->flag & SCONV_FROM_UTF16LE) always_replace = 0; } else if (sc->flag & SCONV_TO_UTF8) { unparse = unicode_to_utf8; if (sc->flag & SCONV_FROM_UTF8) always_replace = 0; } else { /* * This case is going to be converted to another * character-set through iconv. */ always_replace = 0; if (sc->flag & SCONV_FROM_UTF16BE) { unparse = unicode_to_utf16be; ts = 2; } else if (sc->flag & SCONV_FROM_UTF16LE) { unparse = unicode_to_utf16le; ts = 2; } else { unparse = unicode_to_utf8; } } if (sc->flag & SCONV_FROM_UTF16BE) { parse = utf16be_to_unicode; tm = 1; spair = 4;/* surrogate pair size in UTF-16. */ } else if (sc->flag & SCONV_FROM_UTF16LE) { parse = utf16le_to_unicode; tm = 1; spair = 4;/* surrogate pair size in UTF-16. */ } else { parse = cesu8_to_unicode; tm = ts; spair = 6;/* surrogate pair size in UTF-8. */ } if (archive_string_ensure(as, as->length + len * tm + ts) == NULL) return (-1); p = as->s + as->length; endp = as->s + as->buffer_length - ts; while ((n = parse(&uc, s, len)) != 0) { const char *ucptr, *uc2ptr; if (n < 0) { /* Use a replaced unicode character. */ UNPARSE(p, endp, uc); s += n*-1; len -= n*-1; ret = -1; continue; } else if (n == spair || always_replace) /* uc is converted from a surrogate pair. * this should be treated as a changed code. */ ucptr = NULL; else ucptr = s; s += n; len -= n; /* Read second code point. */ while ((n2 = parse(&uc2, s, len)) > 0) { uint32_t ucx[FDC_MAX]; int ccx[FDC_MAX]; int cl, cx, i, nx, ucx_size; int LIndex,SIndex; uint32_t nfc; if (n2 == spair || always_replace) /* uc2 is converted from a surrogate pair. * this should be treated as a changed code. */ uc2ptr = NULL; else uc2ptr = s; s += n2; len -= n2; /* * If current second code point is out of decomposable * code points, finding compositions is unneeded. */ if (!IS_DECOMPOSABLE_BLOCK(uc2)) { WRITE_UC(); REPLACE_UC_WITH_UC2(); continue; } /* * Try to combine current code points. */ /* * We have to combine Hangul characters according to * http://uniicode.org/reports/tr15/#Hangul */ if (0 <= (LIndex = uc - HC_LBASE) && LIndex < HC_LCOUNT) { /* * Hangul Composition. * 1. Two current code points are L and V. */ int VIndex = uc2 - HC_VBASE; if (0 <= VIndex && VIndex < HC_VCOUNT) { /* Make syllable of form LV. */ UPDATE_UC(HC_SBASE + (LIndex * HC_VCOUNT + VIndex) * HC_TCOUNT); } else { WRITE_UC(); REPLACE_UC_WITH_UC2(); } continue; } else if (0 <= (SIndex = uc - HC_SBASE) && SIndex < HC_SCOUNT && (SIndex % HC_TCOUNT) == 0) { /* * Hangul Composition. * 2. Two current code points are LV and T. */ int TIndex = uc2 - HC_TBASE; if (0 < TIndex && TIndex < HC_TCOUNT) { /* Make syllable of form LVT. */ UPDATE_UC(uc + TIndex); } else { WRITE_UC(); REPLACE_UC_WITH_UC2(); } continue; } else if ((nfc = get_nfc(uc, uc2)) != 0) { /* A composition to current code points * is found. */ UPDATE_UC(nfc); continue; } else if ((cl = CCC(uc2)) == 0) { /* Clearly 'uc2' the second code point is not * a decomposable code. */ WRITE_UC(); REPLACE_UC_WITH_UC2(); continue; } /* * Collect following decomposable code points. */ cx = 0; ucx[0] = uc2; ccx[0] = cl; COLLECT_CPS(1); /* * Find a composed code in the collected code points. */ i = 1; while (i < ucx_size) { int j; if ((nfc = get_nfc(uc, ucx[i])) == 0) { i++; continue; } /* * nfc is composed of uc and ucx[i]. */ UPDATE_UC(nfc); /* * Remove ucx[i] by shifting * following code points. */ for (j = i; j+1 < ucx_size; j++) { ucx[j] = ucx[j+1]; ccx[j] = ccx[j+1]; } ucx_size --; /* * Collect following code points blocked * by ucx[i] the removed code point. */ if (ucx_size > 0 && i == ucx_size && nx > 0 && cx == cl) { cl = ccx[ucx_size-1]; COLLECT_CPS(ucx_size); } /* * Restart finding a composed code with * the updated uc from the top of the * collected code points. */ i = 0; } /* * Apparently the current code points are not * decomposed characters or already composed. */ WRITE_UC(); for (i = 0; i < ucx_size; i++) UNPARSE(p, endp, ucx[i]); /* * Flush out remaining canonical combining characters. */ if (nx > 0 && cx == cl && len > 0) { while ((nx = parse(&ucx[0], s, len)) > 0) { cx = CCC(ucx[0]); if (cl > cx) break; s += nx; len -= nx; cl = cx; UNPARSE(p, endp, ucx[0]); } } break; } if (n2 < 0) { WRITE_UC(); /* Use a replaced unicode character. */ UNPARSE(p, endp, uc2); s += n2*-1; len -= n2*-1; ret = -1; continue; } else if (n2 == 0) { WRITE_UC(); break; } } as->length = p - as->s; as->s[as->length] = '\0'; if (ts == 2) as->s[as->length+1] = '\0'; return (ret); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static GF_Err ttml_embed_data(GF_XMLNode *node, u8 *aux_data, u32 aux_data_size, u8 *subs_data, u32 subs_data_size) { u32 i=0; GF_XMLNode *child; u32 subs_idx=0; GF_XMLAttribute *att; Bool is_source = GF_FALSE; Bool has_src_att = GF_FALSE; if (!node || node->type) return GF_BAD_PARAM; if (!strcmp(node->name, "source")) { is_source = GF_TRUE; } while ((att = gf_list_enum(node->attributes, &i))) { char *sep, *fext; if (strcmp(att->name, "src")) continue; has_src_att = GF_TRUE; if (strncmp(att->value, "urn:", 4)) continue; sep = strrchr(att->value, ':'); if (!sep) continue; sep++; fext = gf_file_ext_start(sep); if (fext) fext[0] = 0; subs_idx = atoi(sep); if (fext) fext[0] = '.'; if (!subs_idx || ((subs_idx-1) * 14 > subs_data_size)) { subs_idx = 0; continue; } break; } if (subs_idx) { GF_XMLNode *data; u32 subs_offset = 0; u32 subs_size = 0; u32 idx = 1; //fetch subsample info for (i=0; i<subs_data_size; i+=14) { u32 a_subs_size = subs_data[i+4]; a_subs_size <<= 8; a_subs_size |= subs_data[i+5]; a_subs_size <<= 8; a_subs_size |= subs_data[i+6]; a_subs_size <<= 8; a_subs_size |= subs_data[i+7]; if (idx==subs_idx) { subs_size = a_subs_size; break; } subs_offset += a_subs_size; idx++; } if (!subs_size || (subs_offset + subs_size > aux_data_size)) { if (!subs_size) { GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("No subsample with index %u in sample\n", subs_idx)); } else { GF_LOG(GF_LOG_ERROR, GF_LOG_MEDIA, ("Corrupted subsample %u info, size %u offset %u but sample size %u\n", subs_idx, subs_size, subs_offset, aux_data_size)); } return GF_NON_COMPLIANT_BITSTREAM; } //remove src attribute gf_list_del_item(node->attributes, att); if (att->name) gf_free(att->name); if (att->value) gf_free(att->value); gf_free(att); //create a source node if (!is_source) { GF_XMLNode *s; GF_SAFEALLOC(s, GF_XMLNode); if (!s) return GF_OUT_OF_MEM; s->attributes = gf_list_new(); s->content = gf_list_new(); s->name = gf_strdup("source"); gf_list_add(node->content, s); if (!s->name || !s->content || !s->attributes) return GF_OUT_OF_MEM; //move @type to source att = ttml_get_attr(node, "type"); if (att) { gf_list_del_item(node->attributes, att); gf_list_add(s->attributes, att); } node = s; } //create a data node GF_SAFEALLOC(data, GF_XMLNode); if (!data) return GF_OUT_OF_MEM; data->attributes = gf_list_new(); data->content = gf_list_new(); data->name = gf_strdup("data"); gf_list_add(node->content, data); if (!data->name || !data->content || !data->attributes) return GF_OUT_OF_MEM; //move @type to data att = ttml_get_attr(node, "type"); if (att) { gf_list_del_item(node->attributes, att); gf_list_add(data->attributes, att); } //base64 encode in a child GF_SAFEALLOC(node, GF_XMLNode) if (!node) return GF_OUT_OF_MEM; node->type = GF_XML_TEXT_TYPE; node->name = gf_malloc(sizeof(u8) * subs_size * 2); if (!node->name) { gf_free(node); return GF_OUT_OF_MEM; } subs_size = gf_base64_encode(aux_data + subs_offset, subs_size, (u8*) node->name, subs_size * 2); node->name[subs_size] = 0; return gf_list_add(data->content, node); } //src was present but not an embedded data, do not recurse if (has_src_att) return GF_OK; i=0; while ((child = gf_list_enum(node->content, &i))) { if (child->type) continue; ttml_embed_data(child, aux_data, aux_data_size, subs_data, subs_data_size); } return GF_OK; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) { int r; sigset_t sigsaved; if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); if (unlikely(vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)) { kvm_vcpu_block(vcpu); clear_bit(KVM_REQ_UNHALT, &vcpu->requests); r = -EAGAIN; goto out; } if (vcpu->mmio_needed) { memcpy(vcpu->mmio_data, kvm_run->mmio.data, 8); kvm_set_mmio_data(vcpu); vcpu->mmio_read_completed = 1; vcpu->mmio_needed = 0; } r = __vcpu_run(vcpu, kvm_run); out: if (vcpu->sigset_active) sigprocmask(SIG_SETMASK, &sigsaved, NULL); return r; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int fcn_print_legacy(RCore *core, RAnalFunction *fcn) { RListIter *iter; RAnalRef *refi; RList *refs, *xrefs; int ebbs = 0; char *name = r_core_anal_fcn_name (core, fcn); r_cons_printf ("#\noffset: 0x%08"PFMT64x"\nname: %s\nsize: %"PFMT64u, fcn->addr, name, r_anal_function_linear_size (fcn)); r_cons_printf ("\nis-pure: %s", r_str_bool (r_anal_function_purity (fcn))); r_cons_printf ("\nrealsz: %" PFMT64d, r_anal_function_realsize (fcn)); r_cons_printf ("\nstackframe: %d", fcn->maxstack); if (fcn->cc) { r_cons_printf ("\ncall-convention: %s", fcn->cc); } r_cons_printf ("\ncyclomatic-cost: %d", r_anal_function_cost (fcn)); r_cons_printf ("\ncyclomatic-complexity: %d", r_anal_function_complexity (fcn)); r_cons_printf ("\nbits: %d", fcn->bits); r_cons_printf ("\ntype: %s", r_anal_functiontype_tostring (fcn->type)); if (fcn->type == R_ANAL_FCN_TYPE_FCN || fcn->type == R_ANAL_FCN_TYPE_SYM) { r_cons_printf (" [%s]", fcn->diff->type == R_ANAL_DIFF_TYPE_MATCH?"MATCH": fcn->diff->type == R_ANAL_DIFF_TYPE_UNMATCH?"UNMATCH":"NEW"); } r_cons_printf ("\nnum-bbs: %d", r_list_length (fcn->bbs)); r_cons_printf ("\nedges: %d", r_anal_function_count_edges (fcn, &ebbs)); r_cons_printf ("\nend-bbs: %d", ebbs); r_cons_printf ("\ncall-refs:"); int outdegree = 0; refs = r_anal_function_get_refs (fcn); r_list_foreach (refs, iter, refi) { if (refi->type == R_ANAL_REF_TYPE_CALL) { outdegree++; } if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) { r_cons_printf (" 0x%08"PFMT64x" %c", refi->addr, refi->type == R_ANAL_REF_TYPE_CALL?'C':'J'); } } r_cons_printf ("\ndata-refs:"); r_list_foreach (refs, iter, refi) { // global or local? if (refi->type == R_ANAL_REF_TYPE_DATA) { r_cons_printf (" 0x%08"PFMT64x, refi->addr); } } r_list_free (refs); int indegree = 0; r_cons_printf ("\ncode-xrefs:"); xrefs = r_anal_function_get_xrefs (fcn); r_list_foreach (xrefs, iter, refi) { if (refi->type == R_ANAL_REF_TYPE_CODE || refi->type == R_ANAL_REF_TYPE_CALL) { indegree++; r_cons_printf (" 0x%08"PFMT64x" %c", refi->addr, refi->type == R_ANAL_REF_TYPE_CALL?'C':'J'); } } r_cons_printf ("\nnoreturn: %s", r_str_bool (fcn->is_noreturn)); r_cons_printf ("\nin-degree: %d", indegree); r_cons_printf ("\nout-degree: %d", outdegree); r_cons_printf ("\ndata-xrefs:"); r_list_foreach (xrefs, iter, refi) { if (refi->type == R_ANAL_REF_TYPE_DATA) { r_cons_printf (" 0x%08"PFMT64x, refi->addr); } } r_list_free (xrefs); if (fcn->type == R_ANAL_FCN_TYPE_FCN || fcn->type == R_ANAL_FCN_TYPE_SYM) { int args_count = r_anal_var_count_args (fcn); int var_count = r_anal_var_count_locals (fcn); r_cons_printf ("\nlocals: %d\nargs: %d\n", var_count, args_count); r_anal_var_list_show (core->anal, fcn, 'b', 0, NULL); r_anal_var_list_show (core->anal, fcn, 's', 0, NULL); r_anal_var_list_show (core->anal, fcn, 'r', 0, NULL); r_cons_printf ("diff: type: %s", fcn->diff->type == R_ANAL_DIFF_TYPE_MATCH?"match": fcn->diff->type == R_ANAL_DIFF_TYPE_UNMATCH?"unmatch":"new"); if (fcn->diff->addr != -1) { r_cons_printf ("addr: 0x%"PFMT64x, fcn->diff->addr); } if (fcn->diff->name) { r_cons_printf ("function: %s", fcn->diff->name); } } free (name); // traced if (core->dbg->trace->enabled) { is_fcn_traced (core->dbg->trace, fcn); } return 0; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [term_is_gui(char_u *name) { return (STRCMP(name, "builtin_gui") == 0 || STRCMP(name, "gui") == 0); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static llparse_state_t llhttp__internal__run( llhttp__internal_t* state, const unsigned char* p, const unsigned char* endp) { int match; switch ((llparse_state_t) (intptr_t) state->_current) { case s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: s_n_llhttp__internal__n_invoke_llhttp__after_message_complete: { switch (llhttp__after_message_complete(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_finish_1; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_pause_1: s_n_llhttp__internal__n_pause_1: { state->error = 0x16; state->reason = "Pause on CONNECT/Upgrade"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; return s_error; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_is_equal_upgrade: s_n_llhttp__internal__n_invoke_is_equal_upgrade: { switch (llhttp__internal__c_is_equal_upgrade(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; default: goto s_n_llhttp__internal__n_pause_1; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2: { switch (llhttp__on_message_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_is_equal_upgrade; case 21: goto s_n_llhttp__internal__n_pause_5; default: goto s_n_llhttp__internal__n_error_10; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_data_almost_done_skip: s_n_llhttp__internal__n_chunk_data_almost_done_skip: { if (p == endp) { return s_n_llhttp__internal__n_chunk_data_almost_done_skip; } p++; goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_data_almost_done: s_n_llhttp__internal__n_chunk_data_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_chunk_data_almost_done; } p++; goto s_n_llhttp__internal__n_chunk_data_almost_done_skip; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_consume_content_length: s_n_llhttp__internal__n_consume_content_length: { size_t avail; uint64_t need; avail = endp - p; need = state->content_length; if (avail >= need) { p += need; state->content_length = 0; goto s_n_llhttp__internal__n_span_end_llhttp__on_body; } state->content_length -= avail; return s_n_llhttp__internal__n_consume_content_length; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_body: s_n_llhttp__internal__n_span_start_llhttp__on_body: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_body; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_body; goto s_n_llhttp__internal__n_consume_content_length; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_is_equal_content_length: s_n_llhttp__internal__n_invoke_is_equal_content_length: { switch (llhttp__internal__c_is_equal_content_length(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_span_start_llhttp__on_body; default: goto s_n_llhttp__internal__n_invoke_or_flags; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_size_almost_done: s_n_llhttp__internal__n_chunk_size_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_chunk_size_almost_done; } p++; goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_parameters: s_n_llhttp__internal__n_chunk_parameters: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_chunk_parameters; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_chunk_parameters; } case 2: { p++; goto s_n_llhttp__internal__n_chunk_size_almost_done; } default: { goto s_n_llhttp__internal__n_error_6; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_size_otherwise: s_n_llhttp__internal__n_chunk_size_otherwise: { if (p == endp) { return s_n_llhttp__internal__n_chunk_size_otherwise; } switch (*p) { case 13: { p++; goto s_n_llhttp__internal__n_chunk_size_almost_done; } case ' ': { p++; goto s_n_llhttp__internal__n_chunk_parameters; } case ';': { p++; goto s_n_llhttp__internal__n_chunk_parameters; } default: { goto s_n_llhttp__internal__n_error_7; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_size: s_n_llhttp__internal__n_chunk_size: { if (p == endp) { return s_n_llhttp__internal__n_chunk_size; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'A': { p++; match = 10; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'B': { p++; match = 11; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'C': { p++; match = 12; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'D': { p++; match = 13; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'E': { p++; match = 14; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'F': { p++; match = 15; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'a': { p++; match = 10; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'b': { p++; match = 11; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'c': { p++; match = 12; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'd': { p++; match = 13; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'e': { p++; match = 14; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'f': { p++; match = 15; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } default: { goto s_n_llhttp__internal__n_chunk_size_otherwise; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_chunk_size_digit: s_n_llhttp__internal__n_chunk_size_digit: { if (p == endp) { return s_n_llhttp__internal__n_chunk_size_digit; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'A': { p++; match = 10; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'B': { p++; match = 11; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'C': { p++; match = 12; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'D': { p++; match = 13; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'E': { p++; match = 14; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'F': { p++; match = 15; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'a': { p++; match = 10; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'b': { p++; match = 11; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'c': { p++; match = 12; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'd': { p++; match = 13; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'e': { p++; match = 14; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } case 'f': { p++; match = 15; goto s_n_llhttp__internal__n_invoke_mul_add_content_length; } default: { goto s_n_llhttp__internal__n_error_9; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_update_content_length: s_n_llhttp__internal__n_invoke_update_content_length: { switch (llhttp__internal__c_update_content_length(state, p, endp)) { default: goto s_n_llhttp__internal__n_chunk_size_digit; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_consume_content_length_1: s_n_llhttp__internal__n_consume_content_length_1: { size_t avail; uint64_t need; avail = endp - p; need = state->content_length; if (avail >= need) { p += need; state->content_length = 0; goto s_n_llhttp__internal__n_span_end_llhttp__on_body_1; } state->content_length -= avail; return s_n_llhttp__internal__n_consume_content_length_1; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_body_1: s_n_llhttp__internal__n_span_start_llhttp__on_body_1: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_body_1; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_body; goto s_n_llhttp__internal__n_consume_content_length_1; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_eof: s_n_llhttp__internal__n_eof: { if (p == endp) { return s_n_llhttp__internal__n_eof; } p++; goto s_n_llhttp__internal__n_eof; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_body_2: s_n_llhttp__internal__n_span_start_llhttp__on_body_2: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_body_2; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_body; goto s_n_llhttp__internal__n_eof; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete: { switch (llhttp__after_headers_complete(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1; case 2: goto s_n_llhttp__internal__n_invoke_update_content_length; case 3: goto s_n_llhttp__internal__n_span_start_llhttp__on_body_1; case 4: goto s_n_llhttp__internal__n_invoke_update_finish_2; case 5: goto s_n_llhttp__internal__n_error_11; default: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_headers_almost_done: s_n_llhttp__internal__n_headers_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_headers_almost_done; } p++; goto s_n_llhttp__internal__n_invoke_test_flags; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_colon_discard_ws: s_n_llhttp__internal__n_header_field_colon_discard_ws: { if (p == endp) { return s_n_llhttp__internal__n_header_field_colon_discard_ws; } switch (*p) { case ' ': { p++; goto s_n_llhttp__internal__n_header_field_colon_discard_ws; } default: { goto s_n_llhttp__internal__n_header_field_colon; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_error_15: s_n_llhttp__internal__n_error_15: { state->error = 0xa; state->reason = "Invalid header field char"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_header_value: s_n_llhttp__internal__n_span_start_llhttp__on_header_value: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_header_value; goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_discard_lws: s_n_llhttp__internal__n_header_value_discard_lws: { if (p == endp) { return s_n_llhttp__internal__n_header_value_discard_lws; } switch (*p) { case 9: { p++; goto s_n_llhttp__internal__n_header_value_discard_ws; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_discard_ws; } default: { goto s_n_llhttp__internal__n_invoke_load_header_state; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_discard_ws_almost_done: s_n_llhttp__internal__n_header_value_discard_ws_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_header_value_discard_ws_almost_done; } p++; goto s_n_llhttp__internal__n_header_value_discard_lws; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_lws: s_n_llhttp__internal__n_header_value_lws: { if (p == endp) { return s_n_llhttp__internal__n_header_value_lws; } switch (*p) { case 9: { goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; } case ' ': { goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; } default: { goto s_n_llhttp__internal__n_invoke_load_header_state_3; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_almost_done: s_n_llhttp__internal__n_header_value_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_header_value_almost_done; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_header_value_lws; } default: { goto s_n_llhttp__internal__n_error_17; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_lenient: s_n_llhttp__internal__n_header_value_lenient: { if (p == endp) { return s_n_llhttp__internal__n_header_value_lenient; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1; } case 13: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3; } default: { p++; goto s_n_llhttp__internal__n_header_value_lenient; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_otherwise: s_n_llhttp__internal__n_header_value_otherwise: { if (p == endp) { return s_n_llhttp__internal__n_header_value_otherwise; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1; } case 13: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2; } default: { goto s_n_llhttp__internal__n_invoke_test_flags_5; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection_token: s_n_llhttp__internal__n_header_value_connection_token: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_token; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_header_value_connection_token; } case 2: { p++; goto s_n_llhttp__internal__n_header_value_connection; } default: { goto s_n_llhttp__internal__n_header_value_otherwise; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection_ws: s_n_llhttp__internal__n_header_value_connection_ws: { if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_ws; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_header_value_otherwise; } case 13: { goto s_n_llhttp__internal__n_header_value_otherwise; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_connection_ws; } case ',': { p++; goto s_n_llhttp__internal__n_invoke_load_header_state_4; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_4; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection_1: s_n_llhttp__internal__n_header_value_connection_1: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_1; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob4, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_update_header_state_2; } case kMatchPause: { return s_n_llhttp__internal__n_header_value_connection_1; } case kMatchMismatch: { goto s_n_llhttp__internal__n_header_value_connection_token; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection_2: s_n_llhttp__internal__n_header_value_connection_2: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_2; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob5, 9); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_update_header_state_5; } case kMatchPause: { return s_n_llhttp__internal__n_header_value_connection_2; } case kMatchMismatch: { goto s_n_llhttp__internal__n_header_value_connection_token; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection_3: s_n_llhttp__internal__n_header_value_connection_3: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_value_connection_3; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob6, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_update_header_state_6; } case kMatchPause: { return s_n_llhttp__internal__n_header_value_connection_3; } case kMatchMismatch: { goto s_n_llhttp__internal__n_header_value_connection_token; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_connection: s_n_llhttp__internal__n_header_value_connection: { if (p == endp) { return s_n_llhttp__internal__n_header_value_connection; } switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { case 9: { p++; goto s_n_llhttp__internal__n_header_value_connection; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_connection; } case 'c': { p++; goto s_n_llhttp__internal__n_header_value_connection_1; } case 'k': { p++; goto s_n_llhttp__internal__n_header_value_connection_2; } case 'u': { p++; goto s_n_llhttp__internal__n_header_value_connection_3; } default: { goto s_n_llhttp__internal__n_header_value_connection_token; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_error_20: s_n_llhttp__internal__n_error_20: { state->error = 0xb; state->reason = "Content-Length overflow"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_error_21: s_n_llhttp__internal__n_error_21: { state->error = 0xb; state->reason = "Invalid character in Content-Length"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_content_length_ws: s_n_llhttp__internal__n_header_value_content_length_ws: { if (p == endp) { return s_n_llhttp__internal__n_header_value_content_length_ws; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_invoke_or_flags_15; } case 13: { goto s_n_llhttp__internal__n_invoke_or_flags_15; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_content_length_ws; } default: { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_content_length: s_n_llhttp__internal__n_header_value_content_length: { if (p == endp) { return s_n_llhttp__internal__n_header_value_content_length; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_mul_add_content_length_1; } default: { goto s_n_llhttp__internal__n_header_value_content_length_ws; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_te_chunked_last: s_n_llhttp__internal__n_header_value_te_chunked_last: { if (p == endp) { return s_n_llhttp__internal__n_header_value_te_chunked_last; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_invoke_update_header_state_7; } case 13: { goto s_n_llhttp__internal__n_invoke_update_header_state_7; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_te_chunked_last; } default: { goto s_n_llhttp__internal__n_header_value_te_chunked; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_te_token_ows: s_n_llhttp__internal__n_header_value_te_token_ows: { if (p == endp) { return s_n_llhttp__internal__n_header_value_te_token_ows; } switch (*p) { case 9: { p++; goto s_n_llhttp__internal__n_header_value_te_token_ows; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_te_token_ows; } default: { goto s_n_llhttp__internal__n_header_value_te_chunked; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value: s_n_llhttp__internal__n_header_value: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_header_value; } #ifdef __SSE4_2__ if (endp - p >= 16) { __m128i ranges; __m128i input; int avail; int match_len; /* Load input */ input = _mm_loadu_si128((__m128i const*) p); ranges = _mm_loadu_si128((__m128i const*) llparse_blob8); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 6, input, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_NEGATIVE_POLARITY); if (match_len != 0) { p += match_len; goto s_n_llhttp__internal__n_header_value; } goto s_n_llhttp__internal__n_header_value_otherwise; } #endif /* __SSE4_2__ */ switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_header_value; } default: { goto s_n_llhttp__internal__n_header_value_otherwise; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_te_token: s_n_llhttp__internal__n_header_value_te_token: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_header_value_te_token; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_header_value_te_token; } case 2: { p++; goto s_n_llhttp__internal__n_header_value_te_token_ows; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_8; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_te_chunked: s_n_llhttp__internal__n_header_value_te_chunked: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_value_te_chunked; } match_seq = llparse__match_sequence_to_lower_unsafe(state, p, endp, llparse_blob7, 7); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_header_value_te_chunked_last; } case kMatchPause: { return s_n_llhttp__internal__n_header_value_te_chunked; } case kMatchMismatch: { goto s_n_llhttp__internal__n_header_value_te_token; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_header_value; goto s_n_llhttp__internal__n_invoke_load_header_state_2; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_value_discard_ws: s_n_llhttp__internal__n_header_value_discard_ws: { if (p == endp) { return s_n_llhttp__internal__n_header_value_discard_ws; } switch (*p) { case 9: { p++; goto s_n_llhttp__internal__n_header_value_discard_ws; } case 10: { p++; goto s_n_llhttp__internal__n_header_value_discard_lws; } case 13: { p++; goto s_n_llhttp__internal__n_header_value_discard_ws_almost_done; } case ' ': { p++; goto s_n_llhttp__internal__n_header_value_discard_ws; } default: { goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value_1; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_general_otherwise: s_n_llhttp__internal__n_header_field_general_otherwise: { if (p == endp) { return s_n_llhttp__internal__n_header_field_general_otherwise; } switch (*p) { case ':': { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_2; } default: { goto s_n_llhttp__internal__n_error_22; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_general: s_n_llhttp__internal__n_header_field_general: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (p == endp) { return s_n_llhttp__internal__n_header_field_general; } #ifdef __SSE4_2__ if (endp - p >= 16) { __m128i ranges; __m128i input; int avail; int match_len; /* Load input */ input = _mm_loadu_si128((__m128i const*) p); ranges = _mm_loadu_si128((__m128i const*) llparse_blob9); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 16, input, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_NEGATIVE_POLARITY); if (match_len != 0) { p += match_len; goto s_n_llhttp__internal__n_header_field_general; } ranges = _mm_loadu_si128((__m128i const*) llparse_blob10); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 2, input, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_NEGATIVE_POLARITY); if (match_len != 0) { p += match_len; goto s_n_llhttp__internal__n_header_field_general; } goto s_n_llhttp__internal__n_header_field_general_otherwise; } #endif /* __SSE4_2__ */ switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_header_field_general; } default: { goto s_n_llhttp__internal__n_header_field_general_otherwise; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_colon: s_n_llhttp__internal__n_header_field_colon: { if (p == endp) { return s_n_llhttp__internal__n_header_field_colon; } switch (*p) { case ' ': { goto s_n_llhttp__internal__n_invoke_test_flags_4; } case ':': { goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_9; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_3: s_n_llhttp__internal__n_header_field_3: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_3; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob3, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_header_state; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_3; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_4: s_n_llhttp__internal__n_header_field_4: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_4; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob11, 10); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_header_state; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_4; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_2: s_n_llhttp__internal__n_header_field_2: { if (p == endp) { return s_n_llhttp__internal__n_header_field_2; } switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { case 'n': { p++; goto s_n_llhttp__internal__n_header_field_3; } case 't': { p++; goto s_n_llhttp__internal__n_header_field_4; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_1: s_n_llhttp__internal__n_header_field_1: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_1; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob2, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_header_field_2; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_1; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_5: s_n_llhttp__internal__n_header_field_5: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_5; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob12, 15); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_header_state; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_5; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_6: s_n_llhttp__internal__n_header_field_6: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_6; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob13, 16); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_header_state; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_6; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_7: s_n_llhttp__internal__n_header_field_7: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_header_field_7; } match_seq = llparse__match_sequence_to_lower(state, p, endp, llparse_blob14, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_header_state; } case kMatchPause: { return s_n_llhttp__internal__n_header_field_7; } case kMatchMismatch: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field: s_n_llhttp__internal__n_header_field: { if (p == endp) { return s_n_llhttp__internal__n_header_field; } switch (((*p) >= 'A' && (*p) <= 'Z' ? (*p | 0x20) : (*p))) { case 'c': { p++; goto s_n_llhttp__internal__n_header_field_1; } case 'p': { p++; goto s_n_llhttp__internal__n_header_field_5; } case 't': { p++; goto s_n_llhttp__internal__n_header_field_6; } case 'u': { p++; goto s_n_llhttp__internal__n_header_field_7; } default: { goto s_n_llhttp__internal__n_invoke_update_header_state_10; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_header_field: s_n_llhttp__internal__n_span_start_llhttp__on_header_field: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_header_field; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_header_field; goto s_n_llhttp__internal__n_header_field; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_header_field_start: s_n_llhttp__internal__n_header_field_start: { if (p == endp) { return s_n_llhttp__internal__n_header_field_start; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_headers_almost_done; } case 13: { p++; goto s_n_llhttp__internal__n_headers_almost_done; } default: { goto s_n_llhttp__internal__n_span_start_llhttp__on_header_field; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_skip_to_http09: s_n_llhttp__internal__n_url_skip_to_http09: { if (p == endp) { return s_n_llhttp__internal__n_url_skip_to_http09; } p++; goto s_n_llhttp__internal__n_invoke_update_http_major; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_skip_lf_to_http09: s_n_llhttp__internal__n_url_skip_lf_to_http09: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_url_skip_lf_to_http09; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob15, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_update_http_major; } case kMatchPause: { return s_n_llhttp__internal__n_url_skip_lf_to_http09; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_23; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_end_1: s_n_llhttp__internal__n_req_http_end_1: { if (p == endp) { return s_n_llhttp__internal__n_req_http_end_1; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_header_field_start; } default: { goto s_n_llhttp__internal__n_error_24; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_end: s_n_llhttp__internal__n_req_http_end: { if (p == endp) { return s_n_llhttp__internal__n_req_http_end; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_header_field_start; } case 13: { p++; goto s_n_llhttp__internal__n_req_http_end_1; } default: { goto s_n_llhttp__internal__n_error_24; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_minor: s_n_llhttp__internal__n_req_http_minor: { if (p == endp) { return s_n_llhttp__internal__n_req_http_minor; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_store_http_minor; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_store_http_minor; } default: { goto s_n_llhttp__internal__n_error_25; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_dot: s_n_llhttp__internal__n_req_http_dot: { if (p == endp) { return s_n_llhttp__internal__n_req_http_dot; } switch (*p) { case '.': { p++; goto s_n_llhttp__internal__n_req_http_minor; } default: { goto s_n_llhttp__internal__n_error_26; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_major: s_n_llhttp__internal__n_req_http_major: { if (p == endp) { return s_n_llhttp__internal__n_req_http_major; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_store_http_major; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_store_http_major; } default: { goto s_n_llhttp__internal__n_error_27; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_start_1: s_n_llhttp__internal__n_req_http_start_1: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_req_http_start_1; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob16, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_req_http_major; } case kMatchPause: { return s_n_llhttp__internal__n_req_http_start_1; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_29; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_start_2: s_n_llhttp__internal__n_req_http_start_2: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_req_http_start_2; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob17, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_is_equal_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_req_http_start_2; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_29; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_http_start: s_n_llhttp__internal__n_req_http_start: { if (p == endp) { return s_n_llhttp__internal__n_req_http_start; } switch (*p) { case ' ': { p++; goto s_n_llhttp__internal__n_req_http_start; } case 'H': { p++; goto s_n_llhttp__internal__n_req_http_start_1; } case 'I': { p++; goto s_n_llhttp__internal__n_req_http_start_2; } default: { goto s_n_llhttp__internal__n_error_29; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_skip_to_http: s_n_llhttp__internal__n_url_skip_to_http: { if (p == endp) { return s_n_llhttp__internal__n_url_skip_to_http; } p++; goto s_n_llhttp__internal__n_req_http_start; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_fragment: s_n_llhttp__internal__n_url_fragment: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_url_fragment; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_url_fragment; } case 2: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_6; } case 3: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_7; } case 4: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_8; } default: { goto s_n_llhttp__internal__n_error_30; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_end_stub_query_3: s_n_llhttp__internal__n_span_end_stub_query_3: { if (p == endp) { return s_n_llhttp__internal__n_span_end_stub_query_3; } p++; goto s_n_llhttp__internal__n_url_fragment; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_query: s_n_llhttp__internal__n_url_query: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_url_query; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_url_query; } case 2: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_9; } case 3: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_10; } case 4: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_11; } case 5: { goto s_n_llhttp__internal__n_span_end_stub_query_3; } default: { goto s_n_llhttp__internal__n_error_31; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_query_or_fragment: s_n_llhttp__internal__n_url_query_or_fragment: { if (p == endp) { return s_n_llhttp__internal__n_url_query_or_fragment; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_3; } case 13: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_4; } case ' ': { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_5; } case '#': { p++; goto s_n_llhttp__internal__n_url_fragment; } case '?': { p++; goto s_n_llhttp__internal__n_url_query; } default: { goto s_n_llhttp__internal__n_error_32; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_path: s_n_llhttp__internal__n_url_path: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; if (p == endp) { return s_n_llhttp__internal__n_url_path; } #ifdef __SSE4_2__ if (endp - p >= 16) { __m128i ranges; __m128i input; int avail; int match_len; /* Load input */ input = _mm_loadu_si128((__m128i const*) p); ranges = _mm_loadu_si128((__m128i const*) llparse_blob1); /* Find first character that does not match `ranges` */ match_len = _mm_cmpestri(ranges, 12, input, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_RANGES | _SIDD_NEGATIVE_POLARITY); if (match_len != 0) { p += match_len; goto s_n_llhttp__internal__n_url_path; } goto s_n_llhttp__internal__n_url_query_or_fragment; } #endif /* __SSE4_2__ */ switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_url_path; } default: { goto s_n_llhttp__internal__n_url_query_or_fragment; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_stub_path_2: s_n_llhttp__internal__n_span_start_stub_path_2: { if (p == endp) { return s_n_llhttp__internal__n_span_start_stub_path_2; } p++; goto s_n_llhttp__internal__n_url_path; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_stub_path: s_n_llhttp__internal__n_span_start_stub_path: { if (p == endp) { return s_n_llhttp__internal__n_span_start_stub_path; } p++; goto s_n_llhttp__internal__n_url_path; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_stub_path_1: s_n_llhttp__internal__n_span_start_stub_path_1: { if (p == endp) { return s_n_llhttp__internal__n_span_start_stub_path_1; } p++; goto s_n_llhttp__internal__n_url_path; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_server_with_at: s_n_llhttp__internal__n_url_server_with_at: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (p == endp) { return s_n_llhttp__internal__n_url_server_with_at; } switch (lookup_table[(uint8_t) *p]) { case 1: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_12; } case 2: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_13; } case 3: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_14; } case 4: { p++; goto s_n_llhttp__internal__n_url_server; } case 5: { goto s_n_llhttp__internal__n_span_start_stub_path_1; } case 6: { p++; goto s_n_llhttp__internal__n_url_query; } case 7: { p++; goto s_n_llhttp__internal__n_error_33; } default: { goto s_n_llhttp__internal__n_error_34; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_server: s_n_llhttp__internal__n_url_server: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 6, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 0, 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (p == endp) { return s_n_llhttp__internal__n_url_server; } switch (lookup_table[(uint8_t) *p]) { case 1: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url; } case 2: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_1; } case 3: { goto s_n_llhttp__internal__n_span_end_llhttp__on_url_2; } case 4: { p++; goto s_n_llhttp__internal__n_url_server; } case 5: { goto s_n_llhttp__internal__n_span_start_stub_path; } case 6: { p++; goto s_n_llhttp__internal__n_url_query; } case 7: { p++; goto s_n_llhttp__internal__n_url_server_with_at; } default: { goto s_n_llhttp__internal__n_error_35; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_schema_delim_1: s_n_llhttp__internal__n_url_schema_delim_1: { if (p == endp) { return s_n_llhttp__internal__n_url_schema_delim_1; } switch (*p) { case '/': { p++; goto s_n_llhttp__internal__n_url_server; } default: { goto s_n_llhttp__internal__n_error_37; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_schema_delim: s_n_llhttp__internal__n_url_schema_delim: { if (p == endp) { return s_n_llhttp__internal__n_url_schema_delim; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_error_36; } case 13: { p++; goto s_n_llhttp__internal__n_error_36; } case ' ': { p++; goto s_n_llhttp__internal__n_error_36; } case '/': { p++; goto s_n_llhttp__internal__n_url_schema_delim_1; } default: { goto s_n_llhttp__internal__n_error_37; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_end_stub_schema: s_n_llhttp__internal__n_span_end_stub_schema: { if (p == endp) { return s_n_llhttp__internal__n_span_end_stub_schema; } p++; goto s_n_llhttp__internal__n_url_schema_delim; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_schema: s_n_llhttp__internal__n_url_schema: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (p == endp) { return s_n_llhttp__internal__n_url_schema; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_error_36; } case 2: { goto s_n_llhttp__internal__n_span_end_stub_schema; } case 3: { p++; goto s_n_llhttp__internal__n_url_schema; } default: { goto s_n_llhttp__internal__n_error_38; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_url_start: s_n_llhttp__internal__n_url_start: { static uint8_t lookup_table[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (p == endp) { return s_n_llhttp__internal__n_url_start; } switch (lookup_table[(uint8_t) *p]) { case 1: { p++; goto s_n_llhttp__internal__n_error_36; } case 2: { goto s_n_llhttp__internal__n_span_start_stub_path_2; } case 3: { goto s_n_llhttp__internal__n_url_schema; } default: { goto s_n_llhttp__internal__n_error_39; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_url_1: s_n_llhttp__internal__n_span_start_llhttp__on_url_1: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_url_1; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_url; goto s_n_llhttp__internal__n_url_start; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_url: s_n_llhttp__internal__n_span_start_llhttp__on_url: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_url; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_url; goto s_n_llhttp__internal__n_url_server; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_spaces_before_url: s_n_llhttp__internal__n_req_spaces_before_url: { if (p == endp) { return s_n_llhttp__internal__n_req_spaces_before_url; } switch (*p) { case ' ': { p++; goto s_n_llhttp__internal__n_req_spaces_before_url; } default: { goto s_n_llhttp__internal__n_invoke_is_equal_method; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_first_space_before_url: s_n_llhttp__internal__n_req_first_space_before_url: { if (p == endp) { return s_n_llhttp__internal__n_req_first_space_before_url; } switch (*p) { case ' ': { p++; goto s_n_llhttp__internal__n_req_spaces_before_url; } default: { goto s_n_llhttp__internal__n_error_40; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_1: s_n_llhttp__internal__n_start_req_1: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_1; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob0, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 19; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_1; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_2: s_n_llhttp__internal__n_start_req_2: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_2; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob18, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 16; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_2; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_4: s_n_llhttp__internal__n_start_req_4: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_4; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob19, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 22; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_4; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_6: s_n_llhttp__internal__n_start_req_6: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_6; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob20, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 5; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_6; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_7: s_n_llhttp__internal__n_start_req_7: { if (p == endp) { return s_n_llhttp__internal__n_start_req_7; } switch (*p) { case 'Y': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_5: s_n_llhttp__internal__n_start_req_5: { if (p == endp) { return s_n_llhttp__internal__n_start_req_5; } switch (*p) { case 'N': { p++; goto s_n_llhttp__internal__n_start_req_6; } case 'P': { p++; goto s_n_llhttp__internal__n_start_req_7; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_3: s_n_llhttp__internal__n_start_req_3: { if (p == endp) { return s_n_llhttp__internal__n_start_req_3; } switch (*p) { case 'H': { p++; goto s_n_llhttp__internal__n_start_req_4; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_5; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_8: s_n_llhttp__internal__n_start_req_8: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_8; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob21, 5); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 0; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_8; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_9: s_n_llhttp__internal__n_start_req_9: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_9; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob22, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_9; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_10: s_n_llhttp__internal__n_start_req_10: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_10; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob23, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_10; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_12: s_n_llhttp__internal__n_start_req_12: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_12; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob24, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 31; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_12; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_13: s_n_llhttp__internal__n_start_req_13: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_13; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob25, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 9; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_13; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_11: s_n_llhttp__internal__n_start_req_11: { if (p == endp) { return s_n_llhttp__internal__n_start_req_11; } switch (*p) { case 'I': { p++; goto s_n_llhttp__internal__n_start_req_12; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_13; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_15: s_n_llhttp__internal__n_start_req_15: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_15; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob26, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 24; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_15; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_16: s_n_llhttp__internal__n_start_req_16: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_16; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob27, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 23; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_16; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_18: s_n_llhttp__internal__n_start_req_18: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_18; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob28, 7); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 21; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_18; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_20: s_n_llhttp__internal__n_start_req_20: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_20; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob29, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 30; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_20; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_21: s_n_llhttp__internal__n_start_req_21: { if (p == endp) { return s_n_llhttp__internal__n_start_req_21; } switch (*p) { case 'L': { p++; match = 10; goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_19: s_n_llhttp__internal__n_start_req_19: { if (p == endp) { return s_n_llhttp__internal__n_start_req_19; } switch (*p) { case 'A': { p++; goto s_n_llhttp__internal__n_start_req_20; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_21; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_17: s_n_llhttp__internal__n_start_req_17: { if (p == endp) { return s_n_llhttp__internal__n_start_req_17; } switch (*p) { case 'A': { p++; goto s_n_llhttp__internal__n_start_req_18; } case 'C': { p++; goto s_n_llhttp__internal__n_start_req_19; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_22: s_n_llhttp__internal__n_start_req_22: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_22; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob30, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 11; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_22; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_14: s_n_llhttp__internal__n_start_req_14: { if (p == endp) { return s_n_llhttp__internal__n_start_req_14; } switch (*p) { case '-': { p++; goto s_n_llhttp__internal__n_start_req_15; } case 'E': { p++; goto s_n_llhttp__internal__n_start_req_16; } case 'K': { p++; goto s_n_llhttp__internal__n_start_req_17; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_22; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_23: s_n_llhttp__internal__n_start_req_23: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_23; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob31, 5); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 25; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_23; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_24: s_n_llhttp__internal__n_start_req_24: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_24; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob32, 6); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 6; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_24; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_26: s_n_llhttp__internal__n_start_req_26: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_26; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob33, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 28; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_26; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_27: s_n_llhttp__internal__n_start_req_27: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_27; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob34, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_27; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_31: s_n_llhttp__internal__n_start_req_31: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_31; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob35, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 12; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_31; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_32: s_n_llhttp__internal__n_start_req_32: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_32; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob36, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 13; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_32; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_30: s_n_llhttp__internal__n_start_req_30: { if (p == endp) { return s_n_llhttp__internal__n_start_req_30; } switch (*p) { case 'F': { p++; goto s_n_llhttp__internal__n_start_req_31; } case 'P': { p++; goto s_n_llhttp__internal__n_start_req_32; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_29: s_n_llhttp__internal__n_start_req_29: { if (p == endp) { return s_n_llhttp__internal__n_start_req_29; } switch (*p) { case 'P': { p++; goto s_n_llhttp__internal__n_start_req_30; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_28: s_n_llhttp__internal__n_start_req_28: { if (p == endp) { return s_n_llhttp__internal__n_start_req_28; } switch (*p) { case 'I': { p++; match = 34; goto s_n_llhttp__internal__n_invoke_store_method_1; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_29; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_34: s_n_llhttp__internal__n_start_req_34: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_34; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob37, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 29; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_34; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_33: s_n_llhttp__internal__n_start_req_33: { if (p == endp) { return s_n_llhttp__internal__n_start_req_33; } switch (*p) { case 'R': { p++; goto s_n_llhttp__internal__n_start_req_34; } case 'T': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_method_1; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_25: s_n_llhttp__internal__n_start_req_25: { if (p == endp) { return s_n_llhttp__internal__n_start_req_25; } switch (*p) { case 'A': { p++; goto s_n_llhttp__internal__n_start_req_26; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_27; } case 'R': { p++; goto s_n_llhttp__internal__n_start_req_28; } case 'U': { p++; goto s_n_llhttp__internal__n_start_req_33; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_37: s_n_llhttp__internal__n_start_req_37: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_37; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob38, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 17; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_37; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_38: s_n_llhttp__internal__n_start_req_38: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_38; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob39, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 20; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_38; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_36: s_n_llhttp__internal__n_start_req_36: { if (p == endp) { return s_n_llhttp__internal__n_start_req_36; } switch (*p) { case 'B': { p++; goto s_n_llhttp__internal__n_start_req_37; } case 'P': { p++; goto s_n_llhttp__internal__n_start_req_38; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_35: s_n_llhttp__internal__n_start_req_35: { if (p == endp) { return s_n_llhttp__internal__n_start_req_35; } switch (*p) { case 'E': { p++; goto s_n_llhttp__internal__n_start_req_36; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_40: s_n_llhttp__internal__n_start_req_40: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_40; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob40, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 14; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_40; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_41: s_n_llhttp__internal__n_start_req_41: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_41; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob41, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 33; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_41; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_42: s_n_llhttp__internal__n_start_req_42: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_42; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob42, 7); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 26; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_42; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_39: s_n_llhttp__internal__n_start_req_39: { if (p == endp) { return s_n_llhttp__internal__n_start_req_39; } switch (*p) { case 'E': { p++; goto s_n_llhttp__internal__n_start_req_40; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_41; } case 'U': { p++; goto s_n_llhttp__internal__n_start_req_42; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_43: s_n_llhttp__internal__n_start_req_43: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_43; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob43, 4); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 7; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_43; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_46: s_n_llhttp__internal__n_start_req_46: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_46; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob44, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 18; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_46; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_48: s_n_llhttp__internal__n_start_req_48: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_48; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob45, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 32; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_48; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_49: s_n_llhttp__internal__n_start_req_49: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_49; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob46, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 15; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_49; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_47: s_n_llhttp__internal__n_start_req_47: { if (p == endp) { return s_n_llhttp__internal__n_start_req_47; } switch (*p) { case 'I': { p++; goto s_n_llhttp__internal__n_start_req_48; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_49; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_50: s_n_llhttp__internal__n_start_req_50: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_req_50; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob47, 8); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 27; goto s_n_llhttp__internal__n_invoke_store_method_1; } case kMatchPause: { return s_n_llhttp__internal__n_start_req_50; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_45: s_n_llhttp__internal__n_start_req_45: { if (p == endp) { return s_n_llhttp__internal__n_start_req_45; } switch (*p) { case 'B': { p++; goto s_n_llhttp__internal__n_start_req_46; } case 'L': { p++; goto s_n_llhttp__internal__n_start_req_47; } case 'S': { p++; goto s_n_llhttp__internal__n_start_req_50; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_44: s_n_llhttp__internal__n_start_req_44: { if (p == endp) { return s_n_llhttp__internal__n_start_req_44; } switch (*p) { case 'N': { p++; goto s_n_llhttp__internal__n_start_req_45; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req: s_n_llhttp__internal__n_start_req: { if (p == endp) { return s_n_llhttp__internal__n_start_req; } switch (*p) { case 'A': { p++; goto s_n_llhttp__internal__n_start_req_1; } case 'B': { p++; goto s_n_llhttp__internal__n_start_req_2; } case 'C': { p++; goto s_n_llhttp__internal__n_start_req_3; } case 'D': { p++; goto s_n_llhttp__internal__n_start_req_8; } case 'G': { p++; goto s_n_llhttp__internal__n_start_req_9; } case 'H': { p++; goto s_n_llhttp__internal__n_start_req_10; } case 'L': { p++; goto s_n_llhttp__internal__n_start_req_11; } case 'M': { p++; goto s_n_llhttp__internal__n_start_req_14; } case 'N': { p++; goto s_n_llhttp__internal__n_start_req_23; } case 'O': { p++; goto s_n_llhttp__internal__n_start_req_24; } case 'P': { p++; goto s_n_llhttp__internal__n_start_req_25; } case 'R': { p++; goto s_n_llhttp__internal__n_start_req_35; } case 'S': { p++; goto s_n_llhttp__internal__n_start_req_39; } case 'T': { p++; goto s_n_llhttp__internal__n_start_req_43; } case 'U': { p++; goto s_n_llhttp__internal__n_start_req_44; } default: { goto s_n_llhttp__internal__n_error_48; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_line_almost_done: s_n_llhttp__internal__n_res_line_almost_done: { if (p == endp) { return s_n_llhttp__internal__n_res_line_almost_done; } p++; goto s_n_llhttp__internal__n_header_field_start; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_status: s_n_llhttp__internal__n_res_status: { if (p == endp) { return s_n_llhttp__internal__n_res_status; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_span_end_llhttp__on_status; } case 13: { goto s_n_llhttp__internal__n_span_end_llhttp__on_status_1; } default: { p++; goto s_n_llhttp__internal__n_res_status; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_span_start_llhttp__on_status: s_n_llhttp__internal__n_span_start_llhttp__on_status: { if (p == endp) { return s_n_llhttp__internal__n_span_start_llhttp__on_status; } state->_span_pos0 = (void*) p; state->_span_cb0 = llhttp__on_status; goto s_n_llhttp__internal__n_res_status; /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_status_start: s_n_llhttp__internal__n_res_status_start: { if (p == endp) { return s_n_llhttp__internal__n_res_status_start; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_header_field_start; } case 13: { p++; goto s_n_llhttp__internal__n_res_line_almost_done; } default: { goto s_n_llhttp__internal__n_span_start_llhttp__on_status; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_status_code_otherwise: s_n_llhttp__internal__n_res_status_code_otherwise: { if (p == endp) { return s_n_llhttp__internal__n_res_status_code_otherwise; } switch (*p) { case 10: { goto s_n_llhttp__internal__n_res_status_start; } case 13: { goto s_n_llhttp__internal__n_res_status_start; } case ' ': { p++; goto s_n_llhttp__internal__n_res_status_start; } default: { goto s_n_llhttp__internal__n_error_42; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_status_code: s_n_llhttp__internal__n_res_status_code: { if (p == endp) { return s_n_llhttp__internal__n_res_status_code; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_mul_add_status_code; } default: { goto s_n_llhttp__internal__n_res_status_code_otherwise; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_http_end: s_n_llhttp__internal__n_res_http_end: { if (p == endp) { return s_n_llhttp__internal__n_res_http_end; } switch (*p) { case ' ': { p++; goto s_n_llhttp__internal__n_invoke_update_status_code; } default: { goto s_n_llhttp__internal__n_error_43; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_http_minor: s_n_llhttp__internal__n_res_http_minor: { if (p == endp) { return s_n_llhttp__internal__n_res_http_minor; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_store_http_minor_1; } default: { goto s_n_llhttp__internal__n_error_44; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_http_dot: s_n_llhttp__internal__n_res_http_dot: { if (p == endp) { return s_n_llhttp__internal__n_res_http_dot; } switch (*p) { case '.': { p++; goto s_n_llhttp__internal__n_res_http_minor; } default: { goto s_n_llhttp__internal__n_error_45; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_res_http_major: s_n_llhttp__internal__n_res_http_major: { if (p == endp) { return s_n_llhttp__internal__n_res_http_major; } switch (*p) { case '0': { p++; match = 0; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '1': { p++; match = 1; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '2': { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '3': { p++; match = 3; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '4': { p++; match = 4; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '5': { p++; match = 5; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '6': { p++; match = 6; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '7': { p++; match = 7; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '8': { p++; match = 8; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } case '9': { p++; match = 9; goto s_n_llhttp__internal__n_invoke_store_http_major_1; } default: { goto s_n_llhttp__internal__n_error_46; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_res: s_n_llhttp__internal__n_start_res: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_start_res; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob48, 5); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_res_http_major; } case kMatchPause: { return s_n_llhttp__internal__n_start_res; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_49; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_or_res_method_2: s_n_llhttp__internal__n_req_or_res_method_2: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_req_or_res_method_2; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob49, 2); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; match = 2; goto s_n_llhttp__internal__n_invoke_store_method; } case kMatchPause: { return s_n_llhttp__internal__n_req_or_res_method_2; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_47; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_or_res_method_3: s_n_llhttp__internal__n_req_or_res_method_3: { llparse_match_t match_seq; if (p == endp) { return s_n_llhttp__internal__n_req_or_res_method_3; } match_seq = llparse__match_sequence_id(state, p, endp, llparse_blob50, 3); p = match_seq.current; switch (match_seq.status) { case kMatchComplete: { p++; goto s_n_llhttp__internal__n_invoke_update_type_1; } case kMatchPause: { return s_n_llhttp__internal__n_req_or_res_method_3; } case kMatchMismatch: { goto s_n_llhttp__internal__n_error_47; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_or_res_method_1: s_n_llhttp__internal__n_req_or_res_method_1: { if (p == endp) { return s_n_llhttp__internal__n_req_or_res_method_1; } switch (*p) { case 'E': { p++; goto s_n_llhttp__internal__n_req_or_res_method_2; } case 'T': { p++; goto s_n_llhttp__internal__n_req_or_res_method_3; } default: { goto s_n_llhttp__internal__n_error_47; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_req_or_res_method: s_n_llhttp__internal__n_req_or_res_method: { if (p == endp) { return s_n_llhttp__internal__n_req_or_res_method; } switch (*p) { case 'H': { p++; goto s_n_llhttp__internal__n_req_or_res_method_1; } default: { goto s_n_llhttp__internal__n_error_47; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start_req_or_res: s_n_llhttp__internal__n_start_req_or_res: { if (p == endp) { return s_n_llhttp__internal__n_start_req_or_res; } switch (*p) { case 'H': { goto s_n_llhttp__internal__n_req_or_res_method; } default: { goto s_n_llhttp__internal__n_invoke_update_type_2; } } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_invoke_load_type: s_n_llhttp__internal__n_invoke_load_type: { switch (llhttp__internal__c_load_type(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_start_req; case 2: goto s_n_llhttp__internal__n_start_res; default: goto s_n_llhttp__internal__n_start_req_or_res; } /* UNREACHABLE */; abort(); } case s_n_llhttp__internal__n_start: s_n_llhttp__internal__n_start: { if (p == endp) { return s_n_llhttp__internal__n_start; } switch (*p) { case 10: { p++; goto s_n_llhttp__internal__n_start; } case 13: { p++; goto s_n_llhttp__internal__n_start; } default: { goto s_n_llhttp__internal__n_invoke_update_finish; } } /* UNREACHABLE */; abort(); } default: /* UNREACHABLE */ abort(); } s_n_llhttp__internal__n_error_36: { state->error = 0x7; state->reason = "Invalid characters in url"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_finish_1: { switch (llhttp__internal__c_update_finish_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_5: { state->error = 0x15; state->reason = "on_message_complete pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_upgrade; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_10: { state->error = 0x12; state->reason = "`on_message_complete` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_7: { state->error = 0x15; state->reason = "on_chunk_complete pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_14: { state->error = 0x14; state->reason = "`on_chunk_complete` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1: { switch (llhttp__on_chunk_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; case 21: goto s_n_llhttp__internal__n_pause_7; default: goto s_n_llhttp__internal__n_error_14; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_12: { state->error = 0x4; state->reason = "Content-Length can't be present with Transfer-Encoding"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_13: { state->error = 0x4; state->reason = "Content-Length can't be present with chunked encoding"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_2: { state->error = 0x15; state->reason = "on_message_complete pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_pause_1; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_3: { state->error = 0x12; state->reason = "`on_message_complete` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_1: { switch (llhttp__on_message_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_pause_1; case 21: goto s_n_llhttp__internal__n_pause_2; default: goto s_n_llhttp__internal__n_error_3; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_8: { state->error = 0xc; state->reason = "Chunk size overflow"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_3: { state->error = 0x15; state->reason = "on_chunk_complete pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_update_content_length; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_5: { state->error = 0x14; state->reason = "`on_chunk_complete` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete: { switch (llhttp__on_chunk_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_update_content_length; case 21: goto s_n_llhttp__internal__n_pause_3; default: goto s_n_llhttp__internal__n_error_5; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_body: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_body(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_chunk_data_almost_done; return s_error; } goto s_n_llhttp__internal__n_chunk_data_almost_done; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags: { switch (llhttp__internal__c_or_flags(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_4: { state->error = 0x15; state->reason = "on_chunk_header pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_is_equal_content_length; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_4: { state->error = 0x13; state->reason = "`on_chunk_header` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_chunk_header: { switch (llhttp__on_chunk_header(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_is_equal_content_length; case 21: goto s_n_llhttp__internal__n_pause_4; default: goto s_n_llhttp__internal__n_error_4; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_6: { state->error = 0x2; state->reason = "Invalid character in chunk parameters"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_7: { state->error = 0xc; state->reason = "Invalid character in chunk size"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_mul_add_content_length: { switch (llhttp__internal__c_mul_add_content_length(state, p, endp, match)) { case 1: goto s_n_llhttp__internal__n_error_8; default: goto s_n_llhttp__internal__n_chunk_size; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_9: { state->error = 0xc; state->reason = "Invalid character in chunk size"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_body_1: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_body(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; return s_error; } goto s_n_llhttp__internal__n_invoke_llhttp__on_message_complete_2; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_finish_2: { switch (llhttp__internal__c_update_finish_2(state, p, endp)) { default: goto s_n_llhttp__internal__n_span_start_llhttp__on_body_2; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_11: { state->error = 0xf; state->reason = "Request has invalid `Transfer-Encoding`"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause: { state->error = 0x15; state->reason = "on_message_complete pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_2: { state->error = 0x12; state->reason = "`on_message_complete` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_message_complete: { switch (llhttp__on_message_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__after_message_complete; case 21: goto s_n_llhttp__internal__n_pause; default: goto s_n_llhttp__internal__n_error_2; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_1: { switch (llhttp__internal__c_or_flags_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_2: { switch (llhttp__internal__c_or_flags_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_upgrade: { switch (llhttp__internal__c_update_upgrade(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_or_flags_2; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_6: { state->error = 0x15; state->reason = "Paused by on_headers_complete"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_1: { state->error = 0x11; state->reason = "User callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete: { switch (llhttp__on_headers_complete(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_llhttp__after_headers_complete; case 1: goto s_n_llhttp__internal__n_invoke_or_flags_1; case 2: goto s_n_llhttp__internal__n_invoke_update_upgrade; case 21: goto s_n_llhttp__internal__n_pause_6; default: goto s_n_llhttp__internal__n_error_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete: { switch (llhttp__before_headers_complete(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__on_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_3: { switch (llhttp__internal__c_test_flags_3(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_error_13; default: goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_2: { switch (llhttp__internal__c_test_flags_2(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_error_12; case 1: goto s_n_llhttp__internal__n_invoke_test_flags_3; default: goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_1: { switch (llhttp__internal__c_test_flags_1(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_test_flags_2; default: goto s_n_llhttp__internal__n_invoke_llhttp__before_headers_complete; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags: { switch (llhttp__internal__c_test_flags(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_invoke_llhttp__on_chunk_complete_1; default: goto s_n_llhttp__internal__n_invoke_test_flags_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_field: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_field(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_15; return s_error; } p++; goto s_n_llhttp__internal__n_error_15; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_4: { switch (llhttp__internal__c_test_flags_2(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_field_colon_discard_ws; default: goto s_n_llhttp__internal__n_span_end_llhttp__on_header_field; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_16: { state->error = 0xb; state->reason = "Empty Content-Length"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_field_start; return s_error; } goto s_n_llhttp__internal__n_header_field_start; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state: { switch (llhttp__internal__c_update_header_state(state, p, endp)) { default: goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_3: { switch (llhttp__internal__c_or_flags_3(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_4: { switch (llhttp__internal__c_or_flags_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_5: { switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_6: { switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_load_header_state_1: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: goto s_n_llhttp__internal__n_invoke_or_flags_3; case 6: goto s_n_llhttp__internal__n_invoke_or_flags_4; case 7: goto s_n_llhttp__internal__n_invoke_or_flags_5; case 8: goto s_n_llhttp__internal__n_invoke_or_flags_6; default: goto s_n_llhttp__internal__n_span_start_llhttp__on_header_value; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_load_header_state: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 2: goto s_n_llhttp__internal__n_error_16; default: goto s_n_llhttp__internal__n_invoke_load_header_state_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_1: { switch (llhttp__internal__c_update_header_state(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_7: { switch (llhttp__internal__c_or_flags_3(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_8: { switch (llhttp__internal__c_or_flags_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_9: { switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_1; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_10: { switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_load_header_state_3: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: goto s_n_llhttp__internal__n_invoke_or_flags_7; case 6: goto s_n_llhttp__internal__n_invoke_or_flags_8; case 7: goto s_n_llhttp__internal__n_invoke_or_flags_9; case 8: goto s_n_llhttp__internal__n_invoke_or_flags_10; default: goto s_n_llhttp__internal__n_header_field_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_17: { state->error = 0x3; state->reason = "Missing expected LF after header value"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value_1: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; return s_error; } goto s_n_llhttp__internal__n_header_value_almost_done; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value_2: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; return s_error; } p++; goto s_n_llhttp__internal__n_header_value_almost_done; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value_3: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_almost_done; return s_error; } p++; goto s_n_llhttp__internal__n_header_value_almost_done; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_18: { state->error = 0xa; state->reason = "Invalid header value char"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_5: { switch (llhttp__internal__c_test_flags_2(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_lenient; default: goto s_n_llhttp__internal__n_error_18; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_3: { switch (llhttp__internal__c_update_header_state(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_11: { switch (llhttp__internal__c_or_flags_3(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_3; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_12: { switch (llhttp__internal__c_or_flags_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_3; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_13: { switch (llhttp__internal__c_or_flags_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_3; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_14: { switch (llhttp__internal__c_or_flags_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_load_header_state_4: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 5: goto s_n_llhttp__internal__n_invoke_or_flags_11; case 6: goto s_n_llhttp__internal__n_invoke_or_flags_12; case 7: goto s_n_llhttp__internal__n_invoke_or_flags_13; case 8: goto s_n_llhttp__internal__n_invoke_or_flags_14; default: goto s_n_llhttp__internal__n_header_value_connection; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_4: { switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection_token; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_2: { switch (llhttp__internal__c_update_header_state_2(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection_ws; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_5: { switch (llhttp__internal__c_update_header_state_5(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection_ws; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_6: { switch (llhttp__internal__c_update_header_state_6(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_connection_ws; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_20; return s_error; } goto s_n_llhttp__internal__n_error_20; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_mul_add_content_length_1: { switch (llhttp__internal__c_mul_add_content_length_1(state, p, endp, match)) { case 1: goto s_n_llhttp__internal__n_span_end_llhttp__on_header_value_4; default: goto s_n_llhttp__internal__n_header_value_content_length; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_15: { switch (llhttp__internal__c_or_flags_15(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_otherwise; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_value_5: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_value(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_error_21; return s_error; } goto s_n_llhttp__internal__n_error_21; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_19: { state->error = 0x4; state->reason = "Duplicate Content-Length"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_test_flags_6: { switch (llhttp__internal__c_test_flags_6(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_header_value_content_length; default: goto s_n_llhttp__internal__n_error_19; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_7: { switch (llhttp__internal__c_update_header_state_7(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_otherwise; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_8: { switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_and_flags: { switch (llhttp__internal__c_and_flags(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_value_te_chunked; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_16: { switch (llhttp__internal__c_or_flags_16(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_and_flags; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_or_flags_17: { switch (llhttp__internal__c_or_flags_17(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_header_state_8; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_load_header_state_2: { switch (llhttp__internal__c_load_header_state(state, p, endp)) { case 1: goto s_n_llhttp__internal__n_header_value_connection; case 2: goto s_n_llhttp__internal__n_invoke_test_flags_6; case 3: goto s_n_llhttp__internal__n_invoke_or_flags_16; case 4: goto s_n_llhttp__internal__n_invoke_or_flags_17; default: goto s_n_llhttp__internal__n_header_value; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_field_1: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_field(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_discard_ws; return s_error; } p++; goto s_n_llhttp__internal__n_header_value_discard_ws; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_header_field_2: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_header_field(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_value_discard_ws; return s_error; } p++; goto s_n_llhttp__internal__n_header_value_discard_ws; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_22: { state->error = 0xa; state->reason = "Invalid header token"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_9: { switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_general; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_header_state: { switch (llhttp__internal__c_store_header_state(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_header_field_colon; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_header_state_10: { switch (llhttp__internal__c_update_header_state_4(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_general; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_http_minor: { switch (llhttp__internal__c_update_http_minor(state, p, endp)) { default: goto s_n_llhttp__internal__n_header_field_start; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_http_major: { switch (llhttp__internal__c_update_http_major(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_update_http_minor; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_3: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_23: { state->error = 0x7; state->reason = "Expected CRLF"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_4: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_lf_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_24: { state->error = 0x9; state->reason = "Expected CRLF after version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_http_minor: { switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_req_http_end; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_25: { state->error = 0x9; state->reason = "Invalid minor version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_26: { state->error = 0x9; state->reason = "Expected dot"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_http_major: { switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_req_http_dot; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_27: { state->error = 0x9; state->reason = "Invalid major version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_29: { state->error = 0x8; state->reason = "Expected HTTP/"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_28: { state->error = 0x8; state->reason = "Expected SOURCE method for ICE/x.x request"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_is_equal_method_1: { switch (llhttp__internal__c_is_equal_method_1(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_error_28; default: goto s_n_llhttp__internal__n_req_http_major; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_5: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_6: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_7: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_lf_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_8: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_30: { state->error = 0x7; state->reason = "Invalid char in url fragment start"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_9: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_10: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_lf_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_11: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_31: { state->error = 0x7; state->reason = "Invalid char in url query"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_32: { state->error = 0x7; state->reason = "Invalid char in url path"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_1: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_lf_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_2: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_12: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_13: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_lf_to_http09; return s_error; } goto s_n_llhttp__internal__n_url_skip_lf_to_http09; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_url_14: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_url(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_url_skip_to_http; return s_error; } goto s_n_llhttp__internal__n_url_skip_to_http; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_33: { state->error = 0x7; state->reason = "Double @ in url"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_34: { state->error = 0x7; state->reason = "Unexpected char in url server"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_35: { state->error = 0x7; state->reason = "Unexpected char in url server"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_37: { state->error = 0x7; state->reason = "Unexpected char in url schema"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_38: { state->error = 0x7; state->reason = "Unexpected char in url schema"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_39: { state->error = 0x7; state->reason = "Unexpected start char in url"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_is_equal_method: { switch (llhttp__internal__c_is_equal_method(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_span_start_llhttp__on_url_1; default: goto s_n_llhttp__internal__n_span_start_llhttp__on_url; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_40: { state->error = 0x6; state->reason = "Expected space after method"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_method_1: { switch (llhttp__internal__c_store_method(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_req_first_space_before_url; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_48: { state->error = 0x6; state->reason = "Invalid method encountered"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_41: { state->error = 0xd; state->reason = "Response overflow"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_mul_add_status_code: { switch (llhttp__internal__c_mul_add_status_code(state, p, endp, match)) { case 1: goto s_n_llhttp__internal__n_error_41; default: goto s_n_llhttp__internal__n_res_status_code; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_status: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_status(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_header_field_start; return s_error; } p++; goto s_n_llhttp__internal__n_header_field_start; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_span_end_llhttp__on_status_1: { const unsigned char* start; int err; start = state->_span_pos0; state->_span_pos0 = NULL; err = llhttp__on_status(state, start, p); if (err != 0) { state->error = err; state->error_pos = (const char*) (p + 1); state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_res_line_almost_done; return s_error; } p++; goto s_n_llhttp__internal__n_res_line_almost_done; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_42: { state->error = 0xd; state->reason = "Invalid response status"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_status_code: { switch (llhttp__internal__c_update_status_code(state, p, endp)) { default: goto s_n_llhttp__internal__n_res_status_code; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_43: { state->error = 0x9; state->reason = "Expected space after version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_http_minor_1: { switch (llhttp__internal__c_store_http_minor(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_res_http_end; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_44: { state->error = 0x9; state->reason = "Invalid minor version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_45: { state->error = 0x9; state->reason = "Expected dot"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_http_major_1: { switch (llhttp__internal__c_store_http_major(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_res_http_dot; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_46: { state->error = 0x9; state->reason = "Invalid major version"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_49: { state->error = 0x8; state->reason = "Expected HTTP/"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_type: { switch (llhttp__internal__c_update_type(state, p, endp)) { default: goto s_n_llhttp__internal__n_req_first_space_before_url; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_store_method: { switch (llhttp__internal__c_store_method(state, p, endp, match)) { default: goto s_n_llhttp__internal__n_invoke_update_type; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error_47: { state->error = 0x8; state->reason = "Invalid word encountered"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_type_1: { switch (llhttp__internal__c_update_type_1(state, p, endp)) { default: goto s_n_llhttp__internal__n_res_http_major; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_type_2: { switch (llhttp__internal__c_update_type(state, p, endp)) { default: goto s_n_llhttp__internal__n_start_req; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_pause_8: { state->error = 0x15; state->reason = "on_message_begin pause"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_n_llhttp__internal__n_invoke_load_type; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_error: { state->error = 0x10; state->reason = "`on_message_begin` callback error"; state->error_pos = (const char*) p; state->_current = (void*) (intptr_t) s_error; return s_error; /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_llhttp__on_message_begin: { switch (llhttp__on_message_begin(state, p, endp)) { case 0: goto s_n_llhttp__internal__n_invoke_load_type; case 21: goto s_n_llhttp__internal__n_pause_8; default: goto s_n_llhttp__internal__n_error; } /* UNREACHABLE */; abort(); } s_n_llhttp__internal__n_invoke_update_finish: { switch (llhttp__internal__c_update_finish(state, p, endp)) { default: goto s_n_llhttp__internal__n_invoke_llhttp__on_message_begin; } /* UNREACHABLE */; abort(); } }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void save_key_to(const char *algo, const char *name, const char *keydata) { const char *error; struct dict_transaction_context *ctx = dict_transaction_begin(keys_dict); dict_set(ctx, t_strconcat(DICT_PATH_SHARED, "default/", algo, "/", name, NULL), keydata); if (dict_transaction_commit(&ctx, &error) < 0) i_error("dict_set(%s) failed: %s", name, error); }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *array_ptr = &EX_T(opline->result.u.var).tmp_var; zval *expr_ptr; zval *offset=NULL; #if 0 || IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV zval **expr_ptr_ptr = NULL; if (opline->extended_value) { expr_ptr_ptr=NULL; expr_ptr = *expr_ptr_ptr; } else { expr_ptr=_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); } #else expr_ptr=_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC); #endif if (1) { /* temporary variable */ zval *new_expr; ALLOC_ZVAL(new_expr); INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; } else { #if 0 || IS_TMP_VAR == IS_VAR || IS_TMP_VAR == IS_CV if (opline->extended_value) { SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr); expr_ptr = *expr_ptr_ptr; Z_ADDREF_P(expr_ptr); } else #endif if (IS_TMP_VAR == IS_CONST || PZVAL_IS_REF(expr_ptr)) { zval *new_expr; ALLOC_ZVAL(new_expr); INIT_PZVAL_COPY(new_expr, expr_ptr); expr_ptr = new_expr; zendi_zval_copy_ctor(*expr_ptr); } else { Z_ADDREF_P(expr_ptr); } } if (offset) { switch (Z_TYPE_P(offset)) { case IS_DOUBLE: zend_hash_index_update(Z_ARRVAL_P(array_ptr), zend_dval_to_lval(Z_DVAL_P(offset)), &expr_ptr, sizeof(zval *), NULL); break; case IS_LONG: case IS_BOOL: zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL); break; case IS_STRING: zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL); break; case IS_NULL: zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: zend_error(E_WARNING, "Illegal offset type"); zval_ptr_dtor(&expr_ptr); /* do nothing */ break; } } else { zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL); } if (opline->extended_value) { } else { } ZEND_VM_NEXT_OPCODE(); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static int fuse_rename2(struct inode *olddir, struct dentry *oldent, struct inode *newdir, struct dentry *newent, unsigned int flags) { struct fuse_conn *fc = get_fuse_conn(olddir); int err; if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) return -EINVAL; if (flags) { if (fc->no_rename2 || fc->minor < 23) return -EINVAL; err = fuse_rename_common(olddir, oldent, newdir, newent, flags, FUSE_RENAME2, sizeof(struct fuse_rename2_in)); if (err == -ENOSYS) { fc->no_rename2 = 1; err = -EINVAL; } } else { err = fuse_rename_common(olddir, oldent, newdir, newent, 0, FUSE_RENAME, sizeof(struct fuse_rename_in)); } return err; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static void tx3g_dump_style_nobox(FILE * trace, GF_StyleRecord *rec, u32 *shift_offset, u32 so_count) { gf_fprintf(trace, "<Style "); if (rec->startCharOffset || rec->endCharOffset) tx3g_print_char_offsets(trace, rec->startCharOffset, rec->endCharOffset, shift_offset, so_count); gf_fprintf(trace, "styles=\""); if (!rec->style_flags) { gf_fprintf(trace, "Normal"); } else { if (rec->style_flags & 1) gf_fprintf(trace, "Bold "); if (rec->style_flags & 2) gf_fprintf(trace, "Italic "); if (rec->style_flags & 4) gf_fprintf(trace, "Underlined "); } gf_fprintf(trace, "\" fontID=\"%d\" fontSize=\"%d\" ", rec->fontID, rec->font_size); tx3g_dump_rgba8(trace, "color", rec->text_color); gf_fprintf(trace, "/>\n"); }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) { unsigned error = 0; size_t i; ucvector tRNS; ucvector_init(&tRNS); if(info->colortype == LCT_PALETTE) { size_t amount = info->palettesize; /*the tail of palette values that all have 255 as alpha, does not have to be encoded*/ for(i = info->palettesize; i > 0; i--) { if(info->palette[4 * (i - 1) + 3] == 255) amount--; else break; } /*add only alpha channel*/ for(i = 0; i < amount; i++) ucvector_push_back(&tRNS, info->palette[4 * i + 3]); } else if(info->colortype == LCT_GREY) { if(info->key_defined) { ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256)); } } else if(info->colortype == LCT_RGB) { if(info->key_defined) { ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_g / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_g % 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_b / 256)); ucvector_push_back(&tRNS, (unsigned char)(info->key_b % 256)); } } error = addChunk(out, "tRNS", tRNS.data, tRNS.size); ucvector_cleanup(&tRNS); return error; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, const u8 *addr, gfp_t gfp) { struct ieee80211_local *local = sdata->local; struct sta_info *sta; struct timespec uptime; struct ieee80211_tx_latency_bin_ranges *tx_latency; int i; sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); if (!sta) return NULL; rcu_read_lock(); tx_latency = rcu_dereference(local->tx_latency); /* init stations Tx latency statistics && TID bins */ if (tx_latency) { sta->tx_lat = kzalloc(IEEE80211_NUM_TIDS * sizeof(struct ieee80211_tx_latency_stat), GFP_ATOMIC); if (!sta->tx_lat) { rcu_read_unlock(); goto free; } if (tx_latency->n_ranges) { for (i = 0; i < IEEE80211_NUM_TIDS; i++) { /* size of bins is size of the ranges +1 */ sta->tx_lat[i].bin_count = tx_latency->n_ranges + 1; sta->tx_lat[i].bins = kcalloc(sta->tx_lat[i].bin_count, sizeof(u32), GFP_ATOMIC); if (!sta->tx_lat[i].bins) { rcu_read_unlock(); goto free; } } } } rcu_read_unlock(); spin_lock_init(&sta->lock); INIT_WORK(&sta->drv_unblock_wk, sta_unblock); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); #ifdef CONFIG_MAC80211_MESH if (ieee80211_vif_is_mesh(&sdata->vif) && !sdata->u.mesh.user_mpm) init_timer(&sta->plink_timer); sta->nonpeer_pm = NL80211_MESH_POWER_ACTIVE; #endif memcpy(sta->sta.addr, addr, ETH_ALEN); sta->local = local; sta->sdata = sdata; sta->last_rx = jiffies; sta->sta_state = IEEE80211_STA_NONE; do_posix_clock_monotonic_gettime(&uptime); sta->last_connected = uptime.tv_sec; ewma_init(&sta->avg_signal, 1024, 8); for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) ewma_init(&sta->chain_signal_avg[i], 1024, 8); if (sta_prepare_rate_control(local, sta, gfp)) goto free; for (i = 0; i < IEEE80211_NUM_TIDS; i++) { /* * timer_to_tid must be initialized with identity mapping * to enable session_timer's data differentiation. See * sta_rx_agg_session_timer_expired for usage. */ sta->timer_to_tid[i] = i; } for (i = 0; i < IEEE80211_NUM_ACS; i++) { skb_queue_head_init(&sta->ps_tx_buf[i]); skb_queue_head_init(&sta->tx_filtered[i]); } for (i = 0; i < IEEE80211_NUM_TIDS; i++) sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); sta->sta.smps_mode = IEEE80211_SMPS_OFF; if (sdata->vif.type == NL80211_IFTYPE_AP || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { struct ieee80211_supported_band *sband = local->hw.wiphy->bands[ieee80211_get_sdata_band(sdata)]; u8 smps = (sband->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> IEEE80211_HT_CAP_SM_PS_SHIFT; /* * Assume that hostapd advertises our caps in the beacon and * this is the known_smps_mode for a station that just assciated */ switch (smps) { case WLAN_HT_SMPS_CONTROL_DISABLED: sta->known_smps_mode = IEEE80211_SMPS_OFF; break; case WLAN_HT_SMPS_CONTROL_STATIC: sta->known_smps_mode = IEEE80211_SMPS_STATIC; break; case WLAN_HT_SMPS_CONTROL_DYNAMIC: sta->known_smps_mode = IEEE80211_SMPS_DYNAMIC; break; default: WARN_ON(1); } } sta_dbg(sdata, "Allocated STA %pM\n", sta->sta.addr); return sta; free: if (sta->tx_lat) { for (i = 0; i < IEEE80211_NUM_TIDS; i++) kfree(sta->tx_lat[i].bins); kfree(sta->tx_lat); } kfree(sta); return NULL; }] Response: 1
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [put_callback(callback_T *cb, typval_T *tv) { if (cb->cb_partial != NULL) { tv->v_type = VAR_PARTIAL; tv->vval.v_partial = cb->cb_partial; ++tv->vval.v_partial->pt_refcount; } else { tv->v_type = VAR_FUNC; tv->vval.v_string = vim_strsave(cb->cb_name); func_ref(cb->cb_name); } }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [bool wsrep_sst_donor_check (sys_var *self, THD* thd, set_var* var) { return 0; }] Response: 0
Instruction: Analyze the code of the program enclosed in square brackets, determine if it has vulnerability, or not, and return the answer as the corresponding target label "1" or "0" respectively. [ CImg<T>& _load_analyze(std::FILE *const file, const char *const filename, float *const voxel_size=0) { if (!file && !filename) throw CImgArgumentException(_cimg_instance "load_analyze(): Specified filename is (null).", cimg_instance); std::FILE *nfile_header = 0, *nfile = 0; if (!file) { CImg<charT> body(1024); const char *const ext = cimg::split_filename(filename,body); if (!cimg::strcasecmp(ext,"hdr")) { // File is an Analyze header file nfile_header = cimg::fopen(filename,"rb"); cimg_sprintf(body._data + std::strlen(body),".img"); nfile = cimg::fopen(body,"rb"); } else if (!cimg::strcasecmp(ext,"img")) { // File is an Analyze data file nfile = cimg::fopen(filename,"rb"); cimg_sprintf(body._data + std::strlen(body),".hdr"); nfile_header = cimg::fopen(body,"rb"); } else nfile_header = nfile = cimg::fopen(filename,"rb"); // File is a Niftii file } else nfile_header = nfile = file; // File is a Niftii file if (!nfile || !nfile_header) throw CImgIOException(_cimg_instance "load_analyze(): Invalid Analyze7.5 or NIFTI header in file '%s'.", cimg_instance, filename?filename:"(FILE*)"); // Read header. bool endian = false; unsigned int header_size; cimg::fread(&header_size,1,nfile_header); if (!header_size) throw CImgIOException(_cimg_instance "load_analyze(): Invalid zero-size header in file '%s'.", cimg_instance, filename?filename:"(FILE*)"); if (header_size>=4096) { endian = true; cimg::invert_endianness(header_size); } unsigned char *const header = new unsigned char[header_size]; cimg::fread(header + 4,header_size - 4,nfile_header); if (!file && nfile_header!=nfile) cimg::fclose(nfile_header); if (endian) { cimg::invert_endianness((short*)(header + 40),5); cimg::invert_endianness((short*)(header + 70),1); cimg::invert_endianness((short*)(header + 72),1); cimg::invert_endianness((float*)(header + 76),4); cimg::invert_endianness((float*)(header + 108),1); cimg::invert_endianness((float*)(header + 112),1); } if (nfile_header==nfile) { const unsigned int vox_offset = (unsigned int)*(float*)(header + 108); std::fseek(nfile,vox_offset,SEEK_SET); } unsigned short *dim = (unsigned short*)(header + 40), dimx = 1, dimy = 1, dimz = 1, dimv = 1; if (!dim[0]) cimg::warn(_cimg_instance "load_analyze(): File '%s' defines an image with zero dimensions.", cimg_instance, filename?filename:"(FILE*)"); if (dim[0]>4) cimg::warn(_cimg_instance "load_analyze(): File '%s' defines an image with %u dimensions, reading only the 4 first.", cimg_instance, filename?filename:"(FILE*)",dim[0]); if (dim[0]>=1) dimx = dim[1]; if (dim[0]>=2) dimy = dim[2]; if (dim[0]>=3) dimz = dim[3]; if (dim[0]>=4) dimv = dim[4]; float scalefactor = *(float*)(header + 112); if (scalefactor==0) scalefactor = 1; const unsigned short datatype = *(unsigned short*)(header + 70); if (voxel_size) { const float *vsize = (float*)(header + 76); voxel_size[0] = vsize[1]; voxel_size[1] = vsize[2]; voxel_size[2] = vsize[3]; } delete[] header; // Read pixel data. assign(dimx,dimy,dimz,dimv); const size_t pdim = (size_t)dimx*dimy*dimz*dimv; switch (datatype) { case 2 : { unsigned char *const buffer = new unsigned char[pdim]; cimg::fread(buffer,pdim,nfile); cimg_foroff(*this,off) _data[off] = (T)(buffer[off]*scalefactor); delete[] buffer; } break; case 4 : { short *const buffer = new short[pdim]; cimg::fread(buffer,pdim,nfile); if (endian) cimg::invert_endianness(buffer,pdim); cimg_foroff(*this,off) _data[off] = (T)(buffer[off]*scalefactor); delete[] buffer; } break; case 8 : { int *const buffer = new int[pdim]; cimg::fread(buffer,pdim,nfile); if (endian) cimg::invert_endianness(buffer,pdim); cimg_foroff(*this,off) _data[off] = (T)(buffer[off]*scalefactor); delete[] buffer; } break; case 16 : { float *const buffer = new float[pdim]; cimg::fread(buffer,pdim,nfile); if (endian) cimg::invert_endianness(buffer,pdim); cimg_foroff(*this,off) _data[off] = (T)(buffer[off]*scalefactor); delete[] buffer; } break; case 64 : { double *const buffer = new double[pdim]; cimg::fread(buffer,pdim,nfile); if (endian) cimg::invert_endianness(buffer,pdim); cimg_foroff(*this,off) _data[off] = (T)(buffer[off]*scalefactor); delete[] buffer; } break; default : if (!file) cimg::fclose(nfile); throw CImgIOException(_cimg_instance "load_analyze(): Unable to load datatype %d in file '%s'", cimg_instance, datatype,filename?filename:"(FILE*)"); } if (!file) cimg::fclose(nfile); return *this;] Response: 0