code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
TfLiteStatus LogicalImpl(TfLiteContext* context, TfLiteNode* node, bool (*func)(bool, bool)) { OpData* data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor...
CWE-125
47
R_API ut64 r_bin_java_element_pair_calc_size(RBinJavaElementValuePair *evp) { ut64 sz = 0; if (evp == NULL) { return sz; } // evp->element_name_idx = r_bin_java_read_short(bin, bin->b->cur); sz += 2; // evp->value = r_bin_java_element_value_new (bin, offset+2); if (evp->value) { sz += r_bin_java_element_valu...
CWE-788
87
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-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOut...
CWE-125
47
TfLiteStatus EvalHashtableFind(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputResourceIdTensor); int resource_id = input_resource_id_tensor->data.i32[0]; const TfLiteTensor* key_tensor = GetInput(context, node, kKeyTensor); const T...
CWE-787
24
TfLiteStatus LessEqualEval(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 = !HaveSameShap...
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteSpaceToDepthParams*>(node->builtin_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTens...
CWE-125
47
ALWAYS_INLINE String serialize_impl(const Variant& value, const SerializeOptions& opts) { switch (value.getType()) { case KindOfClass: case KindOfLazyClass: case KindOfPersistentString: case KindOfString: { auto const str = isStringType(value.getType()...
CWE-787
24
static unsigned short get_ushort(const unsigned char *data) { unsigned short val = *(const unsigned short *)data; #ifdef OPJ_BIG_ENDIAN val = ((val & 0xffU) << 8) | (val >> 8); #endif return val; }
CWE-787
24
Status OpLevelCostEstimator::PredictMaxPool(const OpContext& op_context, NodeCosts* node_costs) const { bool found_unknown_shapes = false; const auto& op_info = op_context.op_info; // x: op_info.inputs(0) ConvolutionDimensions dims = OpDimensionsFromInputs( op_i...
CWE-369
60
int TLSInStream::readTLS(U8* buf, int len, bool wait) { int n; n = in->check(1, 1, wait); if (n == 0) return 0; n = gnutls_record_recv(session, (void *) buf, len); if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN) return 0; if (n < 0) throw TLSException("readTLS", n); return n; }
CWE-787
24
static void jsiDumpInstr(Jsi_Interp *interp, jsi_Pstate *ps, Jsi_Value *_this, jsi_TryList *trylist, jsi_OpCode *ip, Jsi_OpCodes *opcodes) { int i; char buf[200]; jsi_code_decode(interp, ip, ip - opcodes->codes, buf, sizeof(buf)); Jsi_Printf(interp, jsi_Stderr, "%p: %-30.200s : THIS=%s, STACK=[", ip...
CWE-120
44
void PropertiesWidget::loadTorrentInfos(BitTorrent::TorrentHandle *const torrent) { clear(); m_torrent = torrent; downloaded_pieces->setTorrent(m_torrent); pieces_availability->setTorrent(m_torrent); if (!m_torrent) return; // Save path updateSavePath(m_torrent); // Hash hash_lbl->s...
CWE-79
1
int64_t OpLevelCostEstimator::CalculateTensorSize( const OpInfo::TensorProperties& tensor, bool* found_unknown_shapes) { int64_t count = CalculateTensorElementCount(tensor, found_unknown_shapes); int size = DataTypeSize(BaseType(tensor.dtype())); VLOG(2) << "Count: " << count << " DataTypeSize: " << size; r...
CWE-190
19
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteDivParams*>(node->builtin_data); 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 TfLiteTens...
CWE-125
47
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, kInputTensor); const TfLiteTensor* seq_lengths = GetInput(context, node, kSeqLengthsTensor); TF...
CWE-125
47
Variant HHVM_METHOD(XMLReader, expand, const Variant& basenode /* = null */) { auto* data = Native::data<XMLReader>(this_); req::ptr<XMLDocumentData> doc; xmlDocPtr docp = nullptr; SYNC_VM_REGS_SCOPED(); if (!basenode.isNull()) { auto dombasenode = Native::data<DOMNode>(basenode.toObj...
CWE-787
24
TypedValue HHVM_FUNCTION(substr_compare, const String& main_str, const String& str, int offset, int length /* = INT_MAX */, bool case_insensitivity /* = false */) { int s1_len = main_str.size()...
CWE-787
24
void Logger::addPeer(const QString &ip, bool blocked, const QString &reason) { QWriteLocker locker(&lock); Log::Peer temp = { peerCounter++, QDateTime::currentMSecsSinceEpoch(), ip, blocked, reason }; m_peers.push_back(temp); if (m_peers.size() >= MAX_LOG_MESSAGES) m_peers.pop_front(); em...
CWE-79
1
AP4_HdlrAtom::AP4_HdlrAtom(AP4_UI32 size, AP4_UI08 version, AP4_UI32 flags, AP4_ByteStream& stream) : AP4_Atom(AP4_ATOM_TYPE_HDLR, size, version, flags) { AP4_UI32 predefined; stream.ReadUI32(predefined); ...
CWE-125
47
TfLiteStatus LessEval(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(in...
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); // TODO(ahentz):...
CWE-787
24
FdOutStream::FdOutStream(int fd_, bool blocking_, int timeoutms_, int bufSize_) : fd(fd_), blocking(blocking_), timeoutms(timeoutms_), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0) { ptr = start = sentUpTo = new U8[bufSize]; end = start + bufSize; gettimeofday(&lastWrite, NULL); }
CWE-787
24
setSanMatchers(std::vector<envoy::type::matcher::v3::StringMatcher> san_matchers) { san_matchers_ = san_matchers; return *this; }
CWE-295
52
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); switch (input->type) { case kTfLiteInt64: reference_ops::Negate( GetTensorShape(input), GetTensorData...
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { Subgraph* subgraph = reinterpret_cast<Subgraph*>(context->impl_); const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputVariableId); int resource_id = input_resource_id_tensor->data.i32[0]; auto& resources = subgraph->re...
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* fft_length = GetInput(context, node, kFftLengthTensor); const int32_t* fft_length_data = GetTensorData<int32_t>(fft_length); TfLiteTensor* output = GetOutput(conte...
CWE-787
24
TfLiteStatus StoreAllDecodedSequences( TfLiteContext* context, const std::vector<std::vector<std::vector<int>>>& sequences, TfLiteNode* node, int top_paths) { const int32_t batch_size = sequences.size(); std::vector<int32_t> num_entries(top_paths, 0); // Calculate num_entries per path for (const au...
CWE-125
47
QUInt8() {}
CWE-908
48
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); auto* params = ...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); output->type = i...
CWE-787
24
DeletionConfirmationDlg(QWidget *parent, const int &size, const QString &name, bool defaultDeleteFiles): QDialog(parent) { setupUi(this); if (size == 1) label->setText(tr("Are you sure you want to delete '%1' from the transfer list?", "Are you sure you want to delete 'ubuntu-linux-iso' from the transfer...
CWE-79
1
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* data = reinterpret_cast<TfLiteAudioMicrofrontendParams*>(node->user_data); FrontendReset(data->state); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); ...
CWE-787
24
CFontFileBase(char *sFile, int nLen, bool bFreeFileData) { m_sFileData = m_sFile = (unsigned char *)sFile; m_nLen = nLen; m_bFreeFileData = bFreeFileData; m_nPos = 0; }
CWE-787
24
int FileInStream::overrun(int itemSize, int nItems, bool wait) { if (itemSize > (int)sizeof(b)) throw Exception("FileInStream overrun: max itemSize exceeded"); if (end - ptr != 0) memmove(b, ptr, end - ptr); end -= ptr - b; ptr = b; while (end < b + itemSize) { size_t n = fread((U8 *)end, b + ...
CWE-787
24
req::ptr<XMLDocumentData> doc() const { return m_node->doc(); }
CWE-787
24
int Read(void* pDestBuffer, int nSize) { if ( m_nPos + nSize >= m_nLen ) nSize = m_nLen - m_nPos - 1; memcpy( pDestBuffer, (m_sFile + m_nPos), nSize ); m_nPos += nSize; return nSize; }
CWE-787
24
static inline char *parse_ip_address_ex(const char *str, size_t str_len, int *portno, int get_err, zend_string **err) { char *colon; char *host = NULL; #ifdef HAVE_IPV6 char *p; if (*(str) == '[' && str_len > 1) { /* IPV6 notation to specify raw address with port (i.e. [fe80::1]:80) */ p = memchr(str + 1, ']'...
CWE-918
16
TestCertificateValidationContextConfig( envoy::config::core::v3::TypedExtensionConfig config, bool allow_expired_certificate = false, std::vector<envoy::type::matcher::v3::StringMatcher> san_matchers = {}) : allow_expired_certificate_(allow_expired_certificate), api_(Api::createApiForTest()), ...
CWE-295
52
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); output->type = in...
CWE-125
47
TfLiteStatus SimpleStatefulOp::Prepare(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); // Make sure that the input is in uint8_t with at least 1 data entry. const TfLiteTensor* input = tflite::GetInput(context, node, kI...
CWE-787
24
TfLiteStatus NotEqualEval(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 = !HaveSameShape...
CWE-125
47
bool ResourceHandle::ParseFromString(const string& s) { ResourceHandleProto proto; const bool status = proto.ParseFromString(s); if (status) FromProto(proto); return status; }
CWE-617
51
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); ruy::profiler::ScopeLabel label("SquaredDifference"); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2)...
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { OpData* data = reinterpret_cast<OpData*>(node->user_data); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); const TfLiteTensor* input2 = GetInput(context, node, kInputTensor2); TfLiteTensor* output = GetOutput(context, node, kOut...
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-787
24
StatusOr<FullTypeDef> SpecializeType(const AttrSlice& attrs, const OpDef& op_def) { FullTypeDef ft; ft.set_type_id(TFT_PRODUCT); for (int i = 0; i < op_def.output_arg_size(); i++) { auto* t = ft.add_args(); *t = op_def.output_arg(i).experimental_full_type(); // ...
CWE-787
24
bool RepeatedAttrDefEqual( const protobuf::RepeatedPtrField<OpDef::AttrDef>& a1, const protobuf::RepeatedPtrField<OpDef::AttrDef>& a2) { std::unordered_map<string, const OpDef::AttrDef*> a1_set; for (const OpDef::AttrDef& def : a1) { DCHECK(a1_set.find(def.name()) == a1_set.end()) << "AttrDef na...
CWE-617
51
void * alloc_top(size_t size, size_t align) {loop: top -= size; align_top(align); if (top < bottom) {new_chunk(); goto loop;} return top; }
CWE-787
24
TEST_F(ListenerManagerImplQuicOnlyTest, QuicListenerFactoryWithWrongTransportSocket) { 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: [] ...
CWE-295
52
CString CWebSock::GetSkinPath(const CString& sSkinName) { CString sRet = CZNC::Get().GetZNCPath() + "/webskins/" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CZNC::Get().GetCurPath() + "/webskins/" + sSkinName; if (!CFile::IsDir(sRet)) { sRet = CString(_SKINDIR_) + "/" + sSkinNam...
CWE-22
2
HexOutStream::HexOutStream(OutStream& os, int buflen) : out_stream(os), offset(0), bufSize(buflen ? buflen : DEFAULT_BUF_LEN) { if (bufSize % 2) bufSize--; ptr = start = new U8[bufSize]; end = start + bufSize; }
CWE-787
24
TfLiteStatus EvalHashtableImport(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input_resource_id_tensor = GetInput(context, node, kInputResourceIdTensor); const int resource_id = input_resource_id_tensor->data.i32[0]; const TfLiteTensor* key_tensor = GetInput(context, node, kKeyTensor); ...
CWE-125
47
TfLiteStatus EluEval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); switch (input->type) { case kTfLiteFloat32: { optimized_ops::Elu(GetTensorShape(input), GetTensorData<float>(input), ...
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const int num_elements = NumElements(input); switch (input->type) { case kTfLiteInt64: memset(GetTensorData<i...
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 3); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* begin = GetInput(context, node, kBeginTensor); const TfLiteT...
CWE-787
24
inline void pad(int bytes) { while (bytes-- > 0) writeU8(0); }
CWE-787
24
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-369
60
bool logToUSDT(const Array& bt) { std::lock_guard<std::mutex> lock(usdt_mutex); memset(&bt_slab, 0, sizeof(bt_slab)); int i = 0; IterateVNoInc( bt.get(), [&](TypedValue tv) -> bool { if (i >= strobelight::kMaxStackframes) { return true; } assertx(isArrayLikeType(type(tv)));...
CWE-125
47
void * alloc_bottom(size_t size, size_t align) {loop: align_bottom(align); byte * tmp = bottom; bottom += size; if (bottom > top) {new_chunk(); goto loop;} return tmp; }
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteIntArray* input_dims = input->dims; int input_dims_size = input_dims->size;...
CWE-125
47
inline bool checkNoWait(int length) { return check(length, 1, false)!=0; }
CWE-787
24
Jsi_RC jsi_evalcode(jsi_Pstate *ps, Jsi_Func *func, Jsi_OpCodes *opcodes, jsi_ScopeChain *scope, Jsi_Value *fargs, Jsi_Value *_this, Jsi_Value **vret) { Jsi_Interp *interp = ps->interp; if (interp->exited) return JSI_ERROR; Jsi_RC rc; jsi_Frame frame = *interp->frameP...
CWE-120
44
void BinaryParameter::setParam(const void* v, int len) { LOCK_CONFIG; if (immutable) return; vlog.debug("set %s(Binary)", getName()); delete [] value; value = 0; if (len) { value = new char[len]; length = len; memcpy(value, v, len); } }
CWE-787
24
TfLiteStatus PrepareAny(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); const TfLiteTensor* input = GetInput(context, node, 0); TF_LITE_ENSURE_TYPES_EQ(context, input->type, kTfLiteBool); return PrepareSimple(context, node); }
CWE-787
24
Status BuildInputArgIndex(const OpDef::ArgDef& arg_def, AttrSlice attr_values, const FunctionDef::ArgAttrs* arg_attrs, bool ints_on_device, int64_t resource_arg_unique_id) { bool is_type_list; DataTypeVector dtypes; TF_RET...
CWE-617
51
UnicodeString DecimalQuantity::toScientificString() const { U_ASSERT(!isApproximate); UnicodeString result; if (isNegative()) { result.append(u'-'); } if (precision == 0) { result.append(u"0E+0", -1); return result; } // NOTE: It is not safe to add to lOptPos (aka max...
CWE-190
19
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, kInputTensor); const TfLiteTensor* axis = GetInput(context, node, kAxisTensor); TF_LITE_ENSURE_...
CWE-125
47
TfLiteTensor* GetOutput(TfLiteContext* context, const TfLiteNode* node, int index) { if (index >= 0 && index < node->outputs->size) { const int tensor_index = node->outputs->data[index]; if (tensor_index != kTfLiteOptionalTensor) { if (context->tensors != nullptr) { retur...
CWE-787
24
int PackLinuxElf64::canUnpack() { if (super::canUnpack()) { return true; } if (Elf64_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) { PackLinuxElf64help1(fi); Elf64_Phdr const *phdr = phdri, *last_LOAD = nullptr; for (unsigned j = 0; j < e_phnum; ++phdr, ++j) if (Elf64_Ph...
CWE-476
46
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-125
47
void AllocateDataSet(cmsIT8* it8) { TABLE* t = GetTable(it8); if (t -> Data) return; // Already allocated t-> nSamples = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS")); t-> nPatches = atoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS")); t-> Data = (char**)AllocChunk (it8, ((cmsUInt32Number) t...
CWE-190
19
bool IsConvolutionOpSupported(const TfLiteRegistration* registration, const TfLiteNode* node, TfLiteContext* context) { if (node->builtin_data == nullptr) return false; TfLiteFusedActivation activation; if (registration->builtin_code == kTfLiteBuiltinConv2d) { const auto* conv_...
CWE-787
24
int64_t TensorByteSize(const TensorProto& t) { // num_elements returns -1 if shape is not fully defined. int64_t num_elems = TensorShape(t.tensor_shape()).num_elements(); return num_elems < 0 ? -1 : num_elems * DataTypeSize(t.dtype()); }
CWE-617
51
LiteralString(std::string &&s, bool ignore_case) : lit_(s), ignore_case_(ignore_case), is_word_(false) {}
CWE-476
46
LiteralString(const std::string &s, bool ignore_case) : lit_(s), ignore_case_(ignore_case), is_word_(false) {}
CWE-476
46
TfLiteStatus InitializeTemporaries(TfLiteContext* context, TfLiteNode* node, OpContext* op_context) { // Creates a temp index to iterate through input data. OpData* op_data = reinterpret_cast<OpData*>(node->user_data); TfLiteIntArrayFree(node->temporaries); node->temporaries =...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); output->type = i...
CWE-125
47
MONGO_EXPORT int bson_append_string_n( bson *b, const char *name, const char *value, int len ) { return bson_append_string_base( b, name, value, len, BSON_STRING ); }
CWE-190
19
int HexInStream::pos() { return offset + ptr - start; }
CWE-787
24
void RegKey::getBinary(const TCHAR* valname, void** data, int* length, void* def, int deflen) const { try { getBinary(valname, data, length); } catch(rdr::Exception&) { if (deflen) { *data = new char[deflen]; memcpy(*data, def, deflen); } else *data = 0; *length = deflen; } }
CWE-787
24
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-787
24
bool IsPadOpSupported(const TfLiteRegistration* registration, const TfLiteNode* node, TfLiteContext* context) { // padding is d x 2 tensor, where d is the dimension of input. const TfLiteTensor* padding = GetInput(context, node, 1); if (!IsConstantTensor(padding)) { TF_LITE_KERNEL_LOG(co...
CWE-787
24
R_API RBinJavaAnnotation *r_bin_java_annotation_new(ut8 *buffer, ut64 sz, ut64 buf_offset) { ut32 i = 0; RBinJavaAnnotation *annotation = NULL; RBinJavaElementValuePair *evps = NULL; ut64 offset = 0; annotation = R_NEW0 (RBinJavaAnnotation); if (!annotation) { return NULL; } // (ut16) read and set annotation_...
CWE-788
87
TfLiteStatus ComparisonPrepareCommon(TfLiteContext* context, TfLiteNode* node, bool is_string_allowed) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1); con...
CWE-787
24
void operator()(OpKernelContext* ctx, const Index num_segments, const TensorShape& segment_ids_shape, typename TTypes<Index>::ConstFlat segment_ids, const Index data_size, const T* data, typename TTypes<T, 2>::Tensor output) { output.setConst...
CWE-681
59
char* HexOutStream::binToHexStr(const char* data, int length) { char* buffer = new char[length*2+1]; for (int i=0; i<length; i++) { buffer[i*2] = intToHex((data[i] >> 4) & 15); buffer[i*2+1] = intToHex((data[i] & 15)); if (!buffer[i*2] || !buffer[i*2+1]) { delete [] buffer; return 0; } ...
CWE-787
24
void nodeRename(Proxy &node, const RegexMatchConfigs &rename_array, extra_settings &ext) { std::string &remark = node.Remark, original_remark = node.Remark, returned_remark, real_rule; for(const RegexMatchConfig &x : rename_array) { if(!x.Script.empty()) { script_safe_runner(ext...
CWE-434
5
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteSpaceToDepthParams*>(node->builtin_data); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* input = GetInput(context, node, kInputTens...
CWE-787
24
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
void AverageEvalFloat(TfLiteContext* context, TfLiteNode* node, TfLitePoolParams* params, OpData* data, const TfLiteTensor* input, TfLiteTensor* output) { float activation_min, activation_max; CalculateActivationRange(params->activation, &activation_min, ...
CWE-835
42
bool handleBackslash(signed char& out) { char ch = *p++; switch (ch) { case 0: return false; case '"': out = ch; return true; case '\\': out = ch; return true; case '/': out = ch; return true; case 'b': out = '\b'; return true; case 'f': out = '\f'; return true; case ...
CWE-125
47
Status BuildInputArgIndex(const OpDef::ArgDef& arg_def, AttrSlice attr_values, const FunctionDef::ArgAttrs* arg_attrs, bool ints_on_device, int64_t resource_arg_unique_id) { bool is_type_list; DataTypeVector dtypes; TF_RET...
CWE-617
51
std::wstring CreateUniqueTempDirectory() { // We need to put downloaded updates into a directory of their own, because // if we put it in $TMP, some DLLs could be there and interfere with the // installer. // // This code creates a new randomized directory name and tries to create it; // this pr...
CWE-426
70
HexOutStream::writeBuffer() { U8* pos = start; while (pos != ptr) { out_stream.check(2); U8* optr = out_stream.getptr(); U8* oend = out_stream.getend(); int length = min(ptr-pos, (oend-optr)/2); for (int i=0; i<length; i++) { optr[i*2] = intToHex((pos[i] >> 4) & 0xf); optr[i*2+1] = ...
CWE-787
24
MpdCantataMounterInterface * RemoteFsDevice::mounter() { if (!mounterIface) { if (!QDBusConnection::systemBus().interface()->isServiceRegistered(MpdCantataMounterInterface::staticInterfaceName())) { QDBusConnection::systemBus().interface()->startService(MpdCantataMounterInterface::staticInterfac...
CWE-22
2
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteSubParams*>(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-787
24
void RequestContext::StartBackendSpanAndSetTraceContext() { backend_span_.reset(CreateSpan(cloud_trace_.get(), "Backend")); // TODO: A better logic would be to send for GRPC backends the grpc-trace-bin // header, and for http/https backends the X-Cloud-Trace-Context header. std::string trace_context_header = ...
CWE-290
85
ssize_t enc_untrusted_recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen) { int klinux_flags = TokLinuxRecvSendFlag(flags); if (klinux_flags == 0 && flags != 0) { errno = EINVAL; return -1; } MessageWriter input; input.P...
CWE-120
44
inline bool ShapeIsVector(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* shape = GetInput(context, node, kShapeTensor); return (shape->dims->size == 1 && shape->type == kTfLiteInt32); }
CWE-787
24