code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* output = GetOutput(context, node, kOutputTensor); switch (output->type) { case kTfLiteFloat32: { return ReverseSequenceHelper<float>(context, node); } case kTfLiteUInt8: { return ReverseSequenceHelper<uint8_t>(conte...
CWE-125
47
void PCRECache::dump(const std::string& filename) { std::ofstream out(filename.c_str()); switch (m_kind) { case CacheKind::Static: for (auto& it : *m_staticCache) { out << it.first->data() << "\n"; } break; case CacheKind::Lru: case CacheKind::Scalable: { std::vec...
CWE-22
2
static int lookup1_values(int entries, int dim) { int r = (int) floor(exp((float) log((float) entries) / dim)); if ((int) floor(pow((float) r+1, dim)) <= entries) // (int) cast for MinGW warning; ++r; // floor() to avoid _ftol() when non-CRT assert(pow((floa...
CWE-476
46
int64_t MemFile::readImpl(char *buffer, int64_t length) { assertx(m_len != -1); assertx(length > 0); int64_t remaining = m_len - m_cursor; if (remaining < length) length = remaining; if (length > 0) { memcpy(buffer, (const void *)(m_data + m_cursor), length); } m_cursor += length; return length; }
CWE-125
47
R_API RBinJavaVerificationObj *r_bin_java_verification_info_from_type(RBinJavaObj *bin, R_BIN_JAVA_STACKMAP_TYPE type, ut32 value) { RBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj); if (!se) { return NULL; } se->tag = type; if (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) { se->info.obj_val_cp_idx = (...
CWE-805
63
bool Decode(string_view encoded, std::string* raw) { for (auto iter = encoded.begin(); iter != encoded.end(); ++iter) { if (*iter == '%') { if (++iter == encoded.end()) { // Invalid URI string, two hexadecimal digits must follow '%'. return false; } int h_decimal = 0; if (...
CWE-22
2
Function *ESTreeIRGen::genGeneratorFunction( Identifier originalName, Variable *lazyClosureAlias, ESTree::FunctionLikeNode *functionNode) { assert(functionNode && "Function AST cannot be null"); // Build the outer function which creates the generator. // Does not have an associated source range. au...
CWE-125
47
TfLiteStatus EluPrepare(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); OpData* data = reinterpret_cast<OpData*>(node->user_data); // Use LUT to handle quantized elu path. if (input->type == kTfLiteInt8) {...
CWE-125
47
int bmp_validate(jas_stream_t *in) { int n; int i; uchar buf[2]; assert(JAS_STREAM_MAXPUTBACK >= 2); /* Read the first two characters that constitute the signature. */ if ((n = jas_stream_read(in, (char *) buf, 2)) < 0) { return -1; } /* Put the characters read back onto the stream. */ for (i = n - 1; i >=...
CWE-190
19
MONGO_EXPORT int bson_buffer_size( const bson *b ) { return (b->cur - b->data + 1); }
CWE-190
19
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { // Check that the inputs and outputs have the right sizes and types. TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTenso...
CWE-787
24
TfLiteStatus UseDynamicOutputTensors(TfLiteContext* context, TfLiteNode* node) { for (int i = 0; i < NumOutputs(node); ++i) { SetTensorToDynamic(GetOutput(context, node, i)); } return kTfLiteOk; }
CWE-787
24
static CPINLINE zend_class_entry* swoole_try_get_ce(zend_string *class_name) { //user class , do not support incomplete class now zend_class_entry *ce = zend_lookup_class(class_name); if (ce) { return ce; } // try call unserialize callback and retry lookup zval user_func, args[1], re...
CWE-502
15
Status SetUnknownShape(const NodeDef* node, int output_port) { shape_inference::ShapeHandle shape = GetUnknownOutputShape(node, output_port); InferenceContext* ctx = GetContext(node); if (ctx == nullptr) { return errors::InvalidArgument("Missing context"); } ctx->set_output(output_po...
CWE-787
24
R_API RBinJavaVerificationObj *r_bin_java_verification_info_from_type(RBinJavaObj *bin, R_BIN_JAVA_STACKMAP_TYPE type, ut32 value) { RBinJavaVerificationObj *se = R_NEW0 (RBinJavaVerificationObj); if (!se) { return NULL; } se->tag = type; if (se->tag == R_BIN_JAVA_STACKMAP_OBJECT) { se->info.obj_val_cp_idx = (...
CWE-788
87
void CFontFileType1::DecryptEexec(unsigned char** ppEexecBuffer, int nLen) { // Согласно спецификации Type1, первый байт не должен быть ASCII пробелом // (пробел, таб, перенос каретки или перенос строки). unsigned char *sCur = (unsigned char*)(*ppEexecBuffer); while( sCur < (unsi...
CWE-770
37
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); // There are two ways in which the 'output' can be made dynamic: it could be // a string tensor, or its shape cannot b...
CWE-787
24
int GetU16BE (int nPos, bool *pbSuccess) { //*pbSuccess = true; if ( nPos < 0 || nPos + 1 >= m_nLen) { *pbSuccess = false; return 0; } int nRes = m_sFile[ nPos ]; nRes = (nRes << 8) + m_sFil...
CWE-787
24
TEST(BasicInterpreter, AllocateTwice) { Interpreter interpreter; ASSERT_EQ(interpreter.AddTensors(2), kTfLiteOk); ASSERT_EQ(interpreter.SetInputs({0}), kTfLiteOk); ASSERT_EQ(interpreter.SetOutputs({1}), kTfLiteOk); TfLiteQuantizationParams quantized; ASSERT_EQ(interpreter.SetTensorParametersReadWrite(0, kT...
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); OpContext op_context(context, node); TF_LITE_ENSURE_EQ(context, NumOutputs(node), op_context.params->num_splits); auto input_type = op_context.input->type; TF_LITE_ENSURE(context, ...
CWE-787
24
void do_change_user(int afdt_fd) { std::string uname; lwp_read(afdt_fd, uname); if (!uname.length()) return; auto buf = PasswdBuffer{}; struct passwd *pw; if (getpwnam_r(uname.c_str(), &buf.ent, buf.data.get(), buf.size, &pw)) { // TODO(alexeyt) should we log something and/or fail to start? return;...
CWE-787
24
void Compute(OpKernelContext* ctx) override { // This call processes inputs 1 and 2 to write output 0. ReshapeOp::Compute(ctx); const float input_min_float = ctx->input(2).flat<float>()(0); const float input_max_float = ctx->input(3).flat<float>()(0); Tensor* output_min = nullptr; OP_REQUIRES...
CWE-787
24
inline void aligned_free(void* ptr) { folly::detail::aligned_free(ptr); }
CWE-787
24
R_API RBinJavaAttrInfo *r_bin_java_read_next_attr_from_buffer(ut8 *buffer, st64 sz, st64 buf_offset) { RBinJavaAttrInfo *attr = NULL; char *name = NULL; ut64 offset = 0; ut16 name_idx; st64 nsz; RBinJavaAttrMetas *type_info = NULL; if (!buffer || ((int) sz) < 4 || buf_offset < 0) { eprintf ("r_bin_Java_read_n...
CWE-125
47
BinaryParameter::BinaryParameter(const char* name_, const char* desc_, const void* v, int l, ConfigurationObject co) : VoidParameter(name_, desc_, co), value(0), length(0), def_value((char*)v), def_length(l) { if (l) { value = new char[l]; length = l; memcpy(value, v, l); } }
CWE-787
24
Json::Value SGXWalletServer::calculateAllBLSPublicKeysImpl(const Json::Value& publicShares, int t, int n) { spdlog::info("Entering {}", __FUNCTION__); INIT_RESULT(result) try { if (!check_n_t(t, n)) { throw SGXException(INVALID_DKG_PARAMS, "Invalid DKG parameters: n or t "); } ...
CWE-787
24
R_API RBinJavaAttrInfo *r_bin_java_line_number_table_attr_new(ut8 *buffer, ut64 sz, ut64 buf_offset) { ut32 i = 0; ut64 curpos, offset = 0; RBinJavaLineNumberAttribute *lnattr; RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (buffer, sz, buf_offset); if (!attr) { return NULL; } offset += 6; attr->type = ...
CWE-125
47
bool ConstantFolding::IsSimplifiableReshape( const NodeDef& node, const GraphProperties& properties) const { if (!IsReshape(node)) { return false; } CHECK_LE(2, node.input_size()); const NodeDef* new_shape = node_map_->GetNode(node.input(1)); if (!IsReallyConstant(*new_shape)) { return false; } ...
CWE-617
51
int jsi_PstateSetFile(jsi_Pstate *ps, Jsi_Channel fp, int skipbang) { jsi_Lexer *l = ps->lexer; jsi_PstateClear(ps); l->ltype = LT_FILE; l->d.fp = fp; Jsi_Rewind(ps->interp, fp); if (skipbang) { char buf[1000]; if (Jsi_Gets(ps->interp, fp, buf, 1000) && (buf[0] != '#' || buf[1] !...
CWE-120
44
TfLiteStatus L2Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); TfLiteTensor* output = GetOutput(context, node, 0); const TfLiteTensor* input = GetInput(context, node, 0); switch...
CWE-787
24
bool CxImage::Transfer(CxImage &from, bool bTransferFrames /*=true*/) { if (!Destroy()) return false; memcpy(&head,&from.head,sizeof(BITMAPINFOHEADER)); memcpy(&info,&from.info,sizeof(CXIMAGEINFO)); pDib = from.pDib; pSelection = from.pSelection; pAlpha = from.pAlpha; ppLayers = from.ppLayers; ...
CWE-770
37
AP4_AvccAtom::InspectFields(AP4_AtomInspector& inspector) { inspector.AddField("Configuration Version", m_ConfigurationVersion); const char* profile_name = GetProfileName(m_Profile); if (profile_name) { inspector.AddField("Profile", profile_name); } else { inspector.AddField("Profile", m...
CWE-476
46
static int bson_append_estart( bson *b, int type, const char *name, const int dataSize ) { const int len = strlen( name ) + 1; if ( b->finished ) { b->err |= BSON_ALREADY_FINISHED; return BSON_ERROR; } if ( bson_ensure_space( b, 1 + len + dataSize ) == BSON_ERROR ) { return BSO...
CWE-190
19
bool IsOpened() {return hFile!=FILE_BAD_HANDLE;};
CWE-787
24
TEST_F(GroupVerifierTest, TestRequiresAnyWithAllowMissingButOk) { TestUtility::loadFromYaml(RequiresAnyConfig, proto_config_); proto_config_.mutable_rules(0) ->mutable_requires() ->mutable_requires_any() ->add_requirements() ->mutable_allow_missing(); createAsyncMockAuthsAndVerifier(std::...
CWE-303
89
void RequestContext::AddInstanceIdentityToken() { if (!method()) { return; } const auto &audience = method()->backend_jwt_audience(); if (!audience.empty()) { auto &token = service_context() ->global_context() ->GetInstanceIdentityToken(audience) ...
CWE-290
85
void readDataAvailable(size_t len) noexcept override { std::cerr << "readDataAvailable, len " << len << std::endl; currentBuffer.length = len; wcb_->setSocket(socket_); // Write back the same data. socket_->write(wcb_, currentBuffer.buffer, len, writeFlags); buffers.push_back(currentBuffer...
CWE-125
47
static float *get_window(vorb *f, int len) { len <<= 1; if (len == f->blocksize_0) return f->window[0]; if (len == f->blocksize_1) return f->window[1]; assert(0); return NULL; }
CWE-125
47
absl::Status IsSupported(const TfLiteContext* context, const TfLiteNode* tflite_node, const TfLiteRegistration* registration) final { if (mirror_pad_) { const TfLiteMirrorPaddingParams* tf_options; RETURN_IF_ERROR(RetrieveBuiltinData(tflite_node, &...
CWE-125
47
void jas_matrix_asr(jas_matrix_t *matrix, int n) { int i; int j; jas_seqent_t *rowstart; int rowstep; jas_seqent_t *data; assert(n >= 0); if (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) { assert(matrix->rows_); rowstep = jas_matrix_rowstep(matrix); for (i = matrix->numrows_, rowstart...
CWE-190
19
String HHVM_FUNCTION(ldap_escape, const String& value, const String& ignores /* = "" */, int flags /* = 0 */) { char esc[256] = {}; if (flags & k_LDAP_ESCAPE_FILTER) { // llvm.org/bugs/show_bug.cgi?id=18389 esc['*'*1u] = esc['('*1u] = esc[')'*1u] =...
CWE-22
2
TEST_F(ListenerManagerImplQuicOnlyTest, QuicListenerFactoryWithWrongCodec) { const std::string yaml = TestEnvironment::substitute(R"EOF( address: socket_address: address: 127.0.0.1 protocol: UDP port_value: 1234 filter_chains: - filter_chain_match: transport_protocol: "quic" filters: [] transpor...
CWE-295
52
void jas_matrix_bindsub(jas_matrix_t *mat0, jas_matrix_t *mat1, int r0, int c0, int r1, int c1) { int i; if (mat0->data_) { if (!(mat0->flags_ & JAS_MATRIX_REF)) { jas_free(mat0->data_); } mat0->data_ = 0; mat0->datasize_ = 0; } if (mat0->rows_) { jas_free(mat0->rows_); mat0->rows_ = 0; } mat0->...
CWE-190
19
void FdInStream::readBytes(void* data, int length) { if (length < MIN_BULK_SIZE) { InStream::readBytes(data, length); return; } U8* dataPtr = (U8*)data; int n = end - ptr; if (n > length) n = length; memcpy(dataPtr, ptr, n); dataPtr += n; length -= n; ptr += n; while (length > 0) { n...
CWE-787
24
TfLiteStatus ResizeOutput(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const TfLiteTensor* multipliers = GetInput(context, node, kInputMultipliers); const int num_dimensions = NumDi...
CWE-125
47
bool PackLinuxElf64::calls_crt1(Elf64_Rela const *rela, int sz) { if (!dynsym || !dynstr) { return false; } for (unsigned relnum= 0; 0 < sz; (sz -= sizeof(Elf64_Rela)), ++rela, ++relnum) { unsigned const symnum = get_te64(&rela->r_info) >> 32; char const *const symnam = get_dynsym_na...
CWE-190
19
void initialize(const string &path, bool owner) { TRACE_POINT(); this->path = path; this->owner = owner; /* Create the server instance directory. We only need to write to this * directory for these reasons: * 1. Initial population of structure files (structure_version.txt, instance.pid). * 2. Crea...
CWE-59
36
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 5); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* ids = GetInput(context, node, 0); TF_LITE_ENSURE_EQ(context, NumDimensions(ids), 1); TF_LITE_ENSURE_EQ(context, ids->type, kTfL...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor...
CWE-125
47
TfLiteStatus GenericPrepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLitePoolParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TfLiteTen...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 3); OpContext op_context(context, node); TF_LITE_ENSURE_EQ(context, NumOutputs(node), op_context.params->num_splits); auto input_type = op_context.input->type; TF_LITE_ENSURE(context, ...
CWE-125
47
void FileBody::Dump(std::ostream& os, const std::string& prefix) const { os << prefix << "<file: " << path_.string() << ">" << std::endl; }
CWE-22
2
static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t length) { size_t l1, l2=0; if ((l1 = php_strnlen(buffer+2, length-2)) > 0) { exif_iif_add_tag(ImageInfo, SECTION_APP12, "Company", TAG_NONE, TAG_FMT_STRING, l1, buffer+2); if (...
CWE-125
47
int zgfx_decompress(ZGFX_CONTEXT* zgfx, const BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags) { int status = -1; BYTE descriptor; wStream* stream = Stream_New((BYTE*)pSrcData, SrcSize); if (!stream) return -1; if (Stream_GetRemainingLength(stream) < 1) go...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* data = GetInput(context, node, kInputDataTensor); const TfLiteTensor* segment_ids = GetInput(context, node, kInputSegmentIds...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteMfccParams*>(node->user_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input_wav = GetInput(context, node, kInputTensorWav); con...
CWE-125
47
RemoteFsDevice::RemoteFsDevice(MusicLibraryModel *m, const DeviceOptions &options, const Details &d) : FsDevice(m, d.name, createUdi(d.name)) , mountToken(0) , currentMountStatus(false) , details(d) , proc(0) , mounterIface(0) , messageSent(false) { opts=options; // details.path=Utils...
CWE-22
2
int size() const { return m_str ? m_str->size() : 0; }
CWE-787
24
static Variant HHVM_FUNCTION(bcdiv, const String& left, const String& right, int64_t scale /* = -1 */) { if (scale < 0) scale = BCG(bc_precision); bc_num first, second, result; bc_init_num(&first); bc_init_num(&second); bc_init_num(&result); SCOPE_EXIT { bc_free_num(&first); bc_free_n...
CWE-190
19
R_API RBinJavaAttrInfo *r_bin_java_annotation_default_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { ut64 offset = 0; RBinJavaAttrInfo *attr = NULL; attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset); offset += 6; if (attr && sz >= offset) { attr->type = R_BIN_JAVA_ATTR_TYPE_AN...
CWE-788
87
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 3); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* start = GetInput(context, node, kStartTensor); const TfLiteTensor* limit = GetInput(context, node, kLimitTensor); const TfLiteT...
CWE-787
24
void Lua::setParamsTable(lua_State* vm, const char* table_name, const char* query) const { char outbuf[FILENAME_MAX]; char *where; char *tok; char *query_string = query ? strdup(query) : NULL; lua_newtable(L); if (query_string) { // ntop->getTrace()->traceEvent(TRACE_WARNING, "[HTTP] %s", query_s...
CWE-476
46
TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_STATUS(GenericPrepare(context, node)); TfLiteTensor* output = GetOutput(context, node, 0); if (output->type == kTfLiteUInt8 || output->type == kTfLiteInt8) { HardSwishData* data = static_cast<HardSwishData*>(node->user_d...
CWE-125
47
bool TemporaryFile::deleteTemporaryFile() const { // Have a few attempts at deleting the file before giving up.. for (int i = 5; --i >= 0;) { if (temporaryFile.deleteFile()) return true; Thread::sleep (50); } return false; }
CWE-22
2
void CalculateOutputIndexValueRowID( OpKernelContext* context, const RowPartitionTensor& value_rowids, const vector<INDEX_TYPE>& parent_output_index, INDEX_TYPE output_index_multiplier, INDEX_TYPE output_size, vector<INDEX_TYPE>* result) { const INDEX_TYPE index_size = value_rowids.size();...
CWE-131
88
R_API RBinJavaAttrInfo *r_bin_java_constant_value_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) { ut64 offset = 6; RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset); if (attr) { attr->type = R_BIN_JAVA_ATTR_TYPE_CONST_VALUE_ATTR; attr->info.constant_value_attr...
CWE-125
47
QByteArray Cipher::blowfishECB(QByteArray cipherText, bool direction) { QCA::Initializer init; QByteArray temp = cipherText; //do padding ourselves if (direction) { while ((temp.length() % 8) != 0) temp.append('\0'); } else { temp = b64ToByte(temp); while ((temp....
CWE-125
47
TEST_F(AllowMissingInAndOfOrListTest, GoodAndBadJwts) { EXPECT_CALL(mock_cb_, onComplete(Status::Ok)); // Use the token with example.com issuer for x-other. auto headers = Http::TestRequestHeaderMapImpl{{kExampleHeader, GoodToken}, {kOtherHeader, GoodToken}}; context_ = Verifier::createContext(headers, pa...
CWE-303
89
bool Router::MatchView(const std::string& method, const std::string& url, bool* stream) { assert(stream != nullptr); *stream = false; for (auto& route : routes_) { if (std::find(route.methods.begin(), route.methods.end(), method) == route.methods.end()) { continue; } ...
CWE-22
2
int GetS16BE (int nPos, bool *pbSuccess) { //*pbSuccess = true; if ( nPos < 0 || nPos + 1 >= m_nLen ) { *pbSuccess = false; return 0; } int nRes = m_sFile[nPos]; nRes = (nRes << 8) + m_sFile...
CWE-787
24
int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1) { int i; int j; if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ != mat1->numcols_) { return 1; } for (i = 0; i < mat0->numrows_; i++) { for (j = 0; j < mat0->numcols_; j++) { if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) {...
CWE-190
19
TfLiteStatus HardSwishPrepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_STATUS(GenericPrepare(context, node)); TfLiteTensor* output = GetOutput(context, node, 0); if (output->type == kTfLiteUInt8 || output->type == kTfLiteInt8) { HardSwishData* data = static_cast<HardSwishData*>(node->user_d...
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output_index_tensor = GetOutput(context, node, 1); TF_LITE_ENSURE_EQ(context, NumElements(output_index_tensor), NumElements(input)); switch (input->type) { ...
CWE-125
47
RequestHandler::RequestHandler( std::shared_ptr<CheckWorkflow> check_workflow, std::shared_ptr<context::ServiceContext> service_context, std::unique_ptr<Request> request_data) : context_(new context::RequestContext(service_context, std::move(request_data))), ...
CWE-290
85
static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) { ut8 op_byte = data[0]; ut64 offset = addr - java_get_method_start (); ut8 pos = (offset+1)%4 ? 1 + 4 - (offset+1)%4 : 1; if (op_byte == 0xaa) { // handle a table switch condition if (pos + 8 > len) { return op->size; ...
CWE-125
47
void RegKey::getBinary(const TCHAR* valname, void** data, int* length) const { TCharArray hex(getRepresentation(valname)); if (!rdr::HexInStream::hexStrToBin(CStr(hex.buf), (char**)data, length)) throw rdr::Exception("getBinary failed"); }
CWE-787
24
bool ZlibInStream::decompress(bool wait) { if (!underlying) throw Exception("ZlibInStream overrun: no underlying stream"); zs->next_out = (U8*)end; zs->avail_out = start + bufSize - end; int n = underlying->check(1, 1, wait); if (n == 0) return false; zs->next_in = (U8*)underlying->getptr(); zs->ava...
CWE-787
24
void* sspi_SecureHandleGetLowerPointer(SecHandle* handle) { void* pointer; if (!handle) return NULL; pointer = (void*) ~((size_t) handle->dwLower); return pointer; }
CWE-476
46
static float *get_window(vorb *f, int len) { len <<= 1; if (len == f->blocksize_0) return f->window[0]; if (len == f->blocksize_1) return f->window[1]; assert(0); return NULL; }
CWE-787
24
Jsi_RC Jsi_ValueInsertArray(Jsi_Interp *interp, Jsi_Value *target, int key, Jsi_Value *val, int flags) { if (target->vt != JSI_VT_OBJECT) { if (interp->strict) Jsi_LogWarn("Target is not object"); return JSI_ERROR; } Jsi_Obj *obj = target->d.obj; if (obj->isarrlist) { ...
CWE-190
19
TEST_F(ClusterInfoImplTest, Http3BadConfig) { const std::string yaml = TestEnvironment::substitute(R"EOF( name: name connect_timeout: 0.25s type: STRICT_DNS lb_policy: MAGLEV load_assignment: endpoints: - lb_endpoints: - endpoint: address: ...
CWE-295
52
inline void StringData::setSize(int len) { assertx(!isImmutable() && !hasMultipleRefs()); assertx(len >= 0 && len <= capacity()); mutableData()[len] = 0; m_lenAndHash = len; assertx(m_hash == 0); assertx(checkSane()); }
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInput); const TfLiteTensor* axis = GetInput(context, node, kAxis); TfLiteTensor* output = GetOu...
CWE-125
47
TfLiteStatus EqualEval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); bool requires_broadcast = !HaveSameShapes(i...
CWE-125
47
std::string& attrf(int ncid, int varId, const char * attrName, std::string& alloc) { alloc = ""; size_t len = 0; nc_inq_attlen(ncid, varId, attrName, &len); if(len < 1) { return alloc; } char attr_vals[NC_MAX_NAME + 1]; memse...
CWE-787
24
int bson_ensure_space( bson *b, const int bytesNeeded ) { int pos = b->cur - b->data; char *orig = b->data; int new_size; if ( pos + bytesNeeded <= b->dataSize ) return BSON_OK; new_size = 1.5 * ( b->dataSize + bytesNeeded ); if( new_size < b->dataSize ) { if( ( b->dataSize + ...
CWE-190
19
TfLiteTensor* GetOutput(TfLiteContext* context, const TfLiteNode* node, int index) { if (context->tensors != nullptr) { return &context->tensors[node->outputs->data[index]]; } else { return context->GetTensor(context, node->outputs->data[index]); } }
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteMulParams*>(node->builtin_data); OpData* data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, nod...
CWE-125
47
static Jsi_RC StringSearchCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this, Jsi_Value **ret, Jsi_Func *funcPtr) { int sLen, bLen; const char *source_str; ChkString(_this, funcPtr, source_str, &sLen, &bLen); char *v = _this->d.obj->d.s.str; Jsi_Value *seq = Jsi_ValueArrayIndex(inte...
CWE-120
44
void RegKey::setBinary(const TCHAR* valname, const void* value, int length) const { LONG result = RegSetValueEx(key, valname, 0, REG_BINARY, (const BYTE*)value, length); if (result != ERROR_SUCCESS) throw rdr::SystemException("setBinary", result); }
CWE-787
24
static const char *jsi_evalprint(Jsi_Value *v) { static char buf[100]; if (!v) return "nil"; if (v->vt == JSI_VT_NUMBER) { snprintf(buf, 100, "NUM:%" JSI_NUMGFMT " ", v->d.num); } else if (v->vt == JSI_VT_BOOL) { snprintf(buf, 100, "BOO:%d", v->d.val); } else if (v->vt == JSI...
CWE-120
44
String StringUtil::Crypt(const String& input, const char *salt /* = "" */) { if (salt && salt[0] == '\0') { raise_notice("crypt(): No salt parameter was specified." " You must use a randomly generated salt and a strong" " hash function to produce a secure hash."); } return String(string_crypt(inpu...
CWE-787
24
static int stszin(int size) { int cnt; uint32_t ofs; // version/flags u32in(); // Sample size u32in(); // Number of entries mp4config.frame.ents = u32in(); // fixme: check atom size mp4config.frame.data = malloc(sizeof(*mp4config.frame.data) * (...
CWE-787
24
void BinaryParameter::getData(void** data_, int* length_) const { LOCK_CONFIG; if (length_) *length_ = length; if (data_) { *data_ = new char[length]; memcpy(*data_, value, length); } }
CWE-787
24
void TLSOutStream::flush() { U8* sentUpTo = start; while (sentUpTo < ptr) { int n = writeTLS(sentUpTo, ptr - sentUpTo); sentUpTo += n; offset += n; } ptr = start; out->flush(); }
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { // Just copy input to output. const TfLiteTensor* input = GetInput(context, node, kInput); TfLiteTensor* output = GetOutput(context, node, 0); const TfLiteTensor* axis = GetInput(context, node, kAxis); if (IsDynamicTensor(output)) { int axis_va...
CWE-125
47
TfLiteRegistration OkOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; // Set output size to the input size in OkOp::Prepare(). Code exists to have // a framework in Prepare. The input and output tensors are not used. reg.prepare = [](TfLiteContext* context, TfLiteNode...
CWE-125
47
MONGO_EXPORT int bson_finish( bson *b ) { int i; if( b->err & BSON_NOT_UTF8 ) return BSON_ERROR; if ( ! b->finished ) { if ( bson_ensure_space( b, 1 ) == BSON_ERROR ) return BSON_ERROR; bson_append_byte( b, 0 ); i = b->cur - b->data; bson_little_endian32( b->data, &...
CWE-190
19
const std::string& get_id() const { ceph_assert(t != Wildcard && t != Tenant); return u.id; }
CWE-617
51
void resize (std::size_t new_size_) { _buf_size = new_size_; }
CWE-787
24