code
stringlengths
12
2.05k
label_name
stringlengths
6
8
label
int64
0
95
AP4_AvccAtom::AP4_AvccAtom(AP4_UI32 size, const AP4_UI08* payload) : AP4_Atom(AP4_ATOM_TYPE_AVCC, size) { // make a copy of our configuration bytes unsigned int payload_size = size-AP4_ATOM_HEADER_SIZE; m_RawBytes.SetData(payload, payload_size); // parse the payload m_ConfigurationVersion = pay...
CWE-125
47
TfLiteStatus EvalImpl(TfLiteContext* context, const TfLiteTensor* input, TfLiteNode* node) { // Map from value, to index in the unique elements vector. // Note that we prefer to use map than unordered_map as it showed less // increase in the binary size. std::map<T, int> unique_values; T...
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-805
63
TfLiteStatus GreaterEqualEval(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 = !HaveSameS...
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); if (type == kGenericOptimized) { optimized_ops::Floor(GetTensorShape(input), GetTensorData<float>(input), ...
CWE-787
24
TfLiteRegistration CopyOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.prepare = [](TfLiteContext* context, TfLiteNode* node) { // Set output size to input size const TfLiteTensor* tensor0 = GetInput(context, node, 0); TfLiteTensor* tensor1 = GetOutput(...
CWE-787
24
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-805
63
TEST(DefaultCertValidatorTest, TestMatchSubjectAltNameNotMatched) { bssl::UniquePtr<X509> cert = readCertFromFile(TestEnvironment::substitute( "{{ test_rundir }}/test/extensions/transport_sockets/tls/test_data/san_dns_cert.pem")); envoy::type::matcher::v3::StringMatcher matcher; matcher.MergeFrom(TestUtilit...
CWE-295
52
void Logger::addMessage(const QString &message, const Log::MsgType &type) { QWriteLocker locker(&lock); Log::Msg temp = { msgCounter++, QDateTime::currentMSecsSinceEpoch(), type, message }; m_messages.push_back(temp); if (m_messages.size() >= MAX_LOG_MESSAGES) m_messages.pop_front(); emit...
CWE-79
1
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-125
47
void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon const * pInitPoly ) { //Can't fit this in :-(, throw ? if (mnPoints + nSpace > USHRT_MAX) return; const sal_uInt16 nNewSize = mnPoints + nSpace; const std::size_t nSpaceSize = static_cast<std::size_t>(nSpace) * si...
CWE-787
24
int pnm_validate(jas_stream_t *in) { uchar buf[2]; int i; int n; assert(JAS_STREAM_MAXPUTBACK >= 2); /* Read the first two characters that constitute the signature. */ if ((n = jas_stream_read(in, buf, 2)) < 0) { return -1; } /* Put these characters back to the stream. */ for (i = n - 1; i >= 0; --i) { i...
CWE-190
19
TEST_P(SslSocketTest, Ipv4San) { const std::string client_ctx_yaml = R"EOF( common_tls_context: validation_context: trusted_ca: filename: "{{ test_rundir }}/test/config/integration/certs/upstreamcacert.pem" match_subject_alt_names: exact: "127.0.0.1" )EOF"; const std::string serve...
CWE-295
52
TfLiteRegistration AddOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.custom_name = "my_add"; reg.builtin_code = tflite::BuiltinOperator_CUSTOM; reg.prepare = [](TfLiteContext* context, TfLiteNode* node) { // Set output size to input size const TfLiteTensor* input...
CWE-787
24
ResponsePtr Server::ServeStatic(RequestPtr request) { assert(request->method() == methods::kGet); if (doc_root_.empty()) { LOG_INFO("The doc root was not specified"); return {}; } fs::path path = doc_root_ / request->url().path(); try { // NOTE: FileBody might throw Error::kFileError. auto ...
CWE-22
2
void PngImg::InitStorage_() { rowPtrs_.resize(info_.height, nullptr); data_ = new png_byte[info_.height * info_.rowbytes]; for(size_t i = 0; i < info_.height; ++i) { rowPtrs_[i] = data_ + i * info_.rowbytes; } }
CWE-787
24
void AverageEvalQuantizedUint8(TfLiteContext* context, TfLiteNode* node, TfLitePoolParams* params, OpData* data, const TfLiteTensor* input, TfLiteTensor* output) { int32_t activation_min; int32_t activation_max; (void)Cal...
CWE-835
42
static __forceinline void draw_line(float *output, int x0, int y0, int x1, int y1, int n) { int dy = y1 - y0; int adx = x1 - x0; int ady = abs(dy); int base; int x=x0,y=y0; int err = 0; int sy; #ifdef STB_VORBIS_DIVIDE_TABLE if (adx < DIVTAB_DENOM && ady < DIVTAB_NUMER) { if (dy < 0) { ...
CWE-369
60
TfLiteStatus MaxEval(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); switc...
CWE-787
24
bool MemFile::seek(int64_t offset, int whence /* = SEEK_SET */) { assertx(m_len != -1); if (whence == SEEK_CUR) { if (offset > 0 && offset < bufferedLen()) { setReadPosition(getReadPosition() + offset); setPosition(getPosition() + offset); return true; } offset += getPosition(); wh...
CWE-190
19
void DefaultEnv::Initialize() { sLog = new Log(); SetUpLog(); sEnv = new DefaultEnv(); sForkHandler = new ForkHandler(); sFileTimer = new FileTimer(); sPlugInManager = new PlugInManager(); sPlugInManager->ProcessEnvironmentSettings(); sForkHandler->Registe...
CWE-78
6
TEST_P(SslSocketTest, FailedClientAuthSanVerificationNoClientCert) { const std::string client_ctx_yaml = R"EOF( common_tls_context: )EOF"; const std::string server_ctx_yaml = R"EOF( common_tls_context: tls_certificates: certificate_chain: filename: "{{ test_rundir }}/test/extensions/trans...
CWE-295
52
MONGO_EXPORT int bson_append_symbol_n( bson *b, const char *name, const char *value, int len ) { return bson_append_string_base( b, name, value, len, BSON_SYMBOL ); }
CWE-190
19
jas_image_t *jas_image_create(int numcmpts, jas_image_cmptparm_t *cmptparms, int clrspc) { jas_image_t *image; uint_fast32_t rawsize; uint_fast32_t inmem; int cmptno; jas_image_cmptparm_t *cmptparm; if (!(image = jas_image_create0())) { return 0; } image->clrspc_ = clrspc; image->maxcmpts_ = numcmpts; i...
CWE-190
19
int TLSOutStream::overrun(int itemSize, int nItems) { if (itemSize > bufSize) throw Exception("TLSOutStream overrun: max itemSize exceeded"); flush(); if (itemSize * nItems > end - ptr) nItems = (end - ptr) / itemSize; return nItems; }
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* output = GetOutput(context, node, 0); TfLiteTensor* hits = GetOutput(context, node, 1); const TfLiteTensor* lookup = GetInput(context, node, 0); const TfLiteTensor* key = GetInput(context, node, 1); const TfLiteTensor* value = GetInpu...
CWE-787
24
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-787
24
Status CalculateOutputIndex(OpKernelContext* context, int dimension, const vector<INDEX_TYPE>& parent_output_index, INDEX_TYPE output_index_multiplier, INDEX_TYPE output_size, vector<INDEX_TYPE>* re...
CWE-131
88
String UTF16BEDecoder::to_utf8(const StringView& input) { StringBuilder builder(input.length() / 2); for (size_t i = 0; i < input.length(); i += 2) { u16 code_point = (input[i] << 8) | input[i + 1]; builder.append_code_point(code_point); } return builder.to_string(); }
CWE-120
44
Result ZipFile::uncompressEntry (int index, const File& targetDirectory, bool shouldOverwriteFiles) { auto* zei = entries.getUnchecked (index); #if JUCE_WINDOWS auto entryPath = zei->entry.filename; #else auto entryPath = zei->entry.filename.replaceCharacter ('\\', '/'); #endif if (...
CWE-22
2
TfLiteStatus PrepareHashtable(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 0); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE(context, node->user_data != nullptr); const auto* params = reinterpret_cast<const TfLiteHashtableParams*>(node->user_da...
CWE-125
47
TEST_F(QuantizedConv2DTest, OddPadding) { const int stride = 2; TF_ASSERT_OK(NodeDefBuilder("quantized_conv_op", "QuantizedConv2D") .Input(FakeInput(DT_QUINT8)) .Input(FakeInput(DT_QUINT8)) .Input(FakeInput(DT_FLOAT)) .Input(FakeInput(DT_FL...
CWE-476
46
void AverageEvalQuantizedInt16(TfLiteContext* context, TfLiteNode* node, TfLitePoolParams* params, OpData* data, const TfLiteTensor* input, TfLiteTensor* output) { int32_t activation_min; int32_t activation_max; Calculate...
CWE-835
42
inline bool ShapeIsVector(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* shape = GetInput(context, node, kShapeTensor); return (shape->dims->size == 1 && shape->type == kTfLiteInt32); }
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const CTCBeamSearchDecoderParams* option = reinterpret_cast<CTCBeamSearchDecoderParams*>(node->user_data); const int top_paths = option->top_paths; TF_LITE_ENSURE(context, option->beam_width >= top_paths); TF_LITE_ENSURE_EQ(context, NumInput...
CWE-125
47
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* diag = GetInput(context, node, kDiagonalTensor); FillDiagHelper(input, diag, output); return kTfL...
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); auto* params = ...
CWE-125
47
CharArray(int len) { buf = new char[len](); }
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { static const int kOutputUniqueTensor = 0; static const int kOutputIndexTensor = 1; TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2); const TfLiteTensor* input = GetInput(context, node, 0); TfLite...
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-125
47
int PackLinuxElf32::canUnpack() { if (super::canUnpack()) { return true; } if (Elf32_Ehdr::ET_DYN==get_te16(&ehdri.e_type)) { PackLinuxElf32help1(fi); } return false; }
CWE-476
46
void ResourceHandle::FromProto(const ResourceHandleProto& proto) { set_device(proto.device()); set_container(proto.container()); set_name(proto.name()); set_hash_code(proto.hash_code()); set_maybe_type_name(proto.maybe_type_name()); std::vector<DtypeAndPartialTensorShape> dtypes_and_shapes; for (const aut...
CWE-617
51
int jas_seq2d_output(jas_matrix_t *matrix, FILE *out) { #define MAXLINELEN 80 int i; int j; jas_seqent_t x; char buf[MAXLINELEN + 1]; char sbuf[MAXLINELEN + 1]; int n; fprintf(out, "%"PRIiFAST32" %"PRIiFAST32"\n", jas_seq2d_xstart(matrix), jas_seq2d_ystart(matrix)); fprintf(out, "%"PRIiFAST32" %"PRIiFAST32"...
CWE-190
19
size_t jsuGetFreeStack() { #ifdef ARM void *frame = __builtin_frame_address(0); size_t stackPos = (size_t)((char*)frame); size_t stackEnd = (size_t)((char*)&LINKER_END_VAR); if (stackPos < stackEnd) return 0; // should never happen, but just in case of overflow! return stackPos - stackEnd; #elif defined(LINU...
CWE-190
19
EntropyParser::EntropyParser(class Frame *frame,class Scan *scan) : JKeeper(scan->EnvironOf()), m_pScan(scan), m_pFrame(frame) { m_ucCount = scan->ComponentsInScan(); // The residual scan uses all components here, not just for, but // it does not require the component count either. for(volatile UBYTE i = 0;i...
CWE-476
46
void ZlibInStream::setUnderlying(InStream* is, int bytesIn_) { underlying = is; bytesIn = bytesIn_; ptr = end = start; }
CWE-787
24
bool load_face(Face & face, unsigned int options) { #ifdef GRAPHITE2_TELEMETRY telemetry::category _misc_cat(face.tele.misc); #endif Face::Table silf(face, Tag::Silf, 0x00050000); if (silf) options &= ~gr_face_dumbRendering; else if (!(options & gr_face_dumbRendering)) ...
CWE-476
46
void* TFE_HandleToDLPack(TFE_TensorHandle* h, TF_Status* status) { const Tensor* tensor = GetTensorFromHandle(h, status); TF_DataType data_type = static_cast<TF_DataType>(tensor->dtype()); TensorReference tensor_ref(*tensor); // This will call buf_->Ref() auto* tf_dlm_tensor_ctx = new TfDlManagedTensorCtx(ten...
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); TF_LITE_ENSURE_TYPES_EQ(context, GetInput(context, node, 0)->type, kTfLiteString); TF_LITE_ENSURE_TYPES_EQ(context, GetOutp...
CWE-125
47
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); TF_LITE_ENSURE_EQ(context, NumInputs(node), 1); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); TF_LITE_ENSURE_TY...
CWE-787
24
otError Commissioner::AddJoiner(const Mac::ExtAddress *aEui64, const char *aPskd, uint32_t aTimeout) { otError error = OT_ERROR_NO_BUFS; VerifyOrExit(mState == OT_COMMISSIONER_STATE_ACTIVE, error = OT_ERROR_INVALID_STATE); VerifyOrExit(strlen(aPskd) <= Dtls::kPskMaxLength, error = OT_ERROR_INVALID_ARGS); ...
CWE-787
24
TfLiteStatus ResizeOutputTensor(TfLiteContext* context, const TfLiteTensor* data, const TfLiteTensor* segment_ids, TfLiteTensor* output) { int max_index = -1; const int segment_id_size = segment_ids->dims->data[0]; if ...
CWE-770
37
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-787
24
int FdInStream::overrun(int itemSize, int nItems, bool wait) { if (itemSize > bufSize) throw Exception("FdInStream overrun: max itemSize exceeded"); if (end - ptr != 0) memmove(start, ptr, end - ptr); offset += ptr - start; end -= ptr - start; ptr = start; int bytes_to_read; while (end < start ...
CWE-787
24
Variant HHVM_FUNCTION(mcrypt_generic_init, const Resource& td, const String& key, const String& iv) { auto pm = get_valid_mcrypt_resource(td); if (!pm) { return false; } int max_key_size = mcrypt_enc_get_key_size(pm->m_td...
CWE-190
19
TfLiteStatus GreaterEqualEval(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 = !HaveSameS...
CWE-787
24
explicit UnravelIndexOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
CWE-190
19
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteDivParams*>(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
Java_org_tensorflow_lite_InterpreterTest_getNativeHandleForDelegate( JNIEnv* env, jclass clazz) { // A simple op which outputs a tensor with values of 7. static TfLiteRegistration registration = { .init = nullptr, .free = nullptr, .prepare = [](TfLiteContext* context, TfLiteNode* nod...
CWE-125
47
TfLiteStatus Relu6Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, 0); TfLiteTensor* output = GetOutput(context, node, 0); ReluOpData* data = reinterpret_cast<ReluOpData*>(node->user_data); switch (input->type) { case kTfLiteFloat32: { size_t element...
CWE-787
24
bool IsFullyConnectedOpSupported(const TfLiteRegistration* registration, const TfLiteNode* node, TfLiteContext* context) { if (node->builtin_data == nullptr) return false; const auto* fc_params = reinterpret_cast<const TfLiteFullyConnectedParam...
CWE-125
47
gdImagePtr gdImageCreateTrueColor (int sx, int sy) { int i; gdImagePtr im; if (overflow2(sx, sy)) { return NULL; } if (overflow2(sizeof(unsigned char *), sy)) { return NULL; } if (overflow2(sizeof(int) + sizeof(unsigned char), sx * sy)) { return NULL; } // Check for OOM before doing a ...
CWE-22
2
bool read(ReadonlyBytes buffer) { auto fields_size = sizeof(EndOfCentralDirectory) - sizeof(u8*); if (buffer.size() < fields_size) return false; if (memcmp(buffer.data(), end_of_central_directory_signature, sizeof(end_of_central_directory_signature)) != 0) return ...
CWE-120
44
Variant HHVM_FUNCTION(mcrypt_generic_init, const Resource& td, const String& key, const String& iv) { auto pm = get_valid_mcrypt_resource(td); if (!pm) { return false; } int max_key_size = mcrypt_enc_get_key_size(pm->m_td...
CWE-787
24
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { const CTCBeamSearchDecoderParams* option = reinterpret_cast<CTCBeamSearchDecoderParams*>(node->user_data); const int top_paths = option->top_paths; TF_LITE_ENSURE(context, option->beam_width >= top_paths); TF_LITE_ENSURE_EQ(context, NumInput...
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-787
24
MemInStream(const void* data, int len, bool deleteWhenDone_=false) : start((const U8*)data), deleteWhenDone(deleteWhenDone_) { ptr = start; end = start + len; }
CWE-787
24
inline int StringData::size() const { return m_len; }
CWE-125
47
int jas_memdump(FILE *out, void *data, size_t len) { size_t i; size_t j; uchar *dp; dp = data; for (i = 0; i < len; i += 16) { fprintf(out, "%04zx:", i); for (j = 0; j < 16; ++j) { if (i + j < len) { fprintf(out, " %02x", dp[i + j]); } } fprintf(out, "\n"); } return 0; }
CWE-190
19
std::string encodeBase64(const std::string& input) { using namespace boost::archive::iterators; using b64it = base64_from_binary<transform_width<const char*, 6, 8>>; auto data = input.data(); std::string encoded(b64it(data), b64it(data + (input.length()))); encoded.append((3 - (input.length() % 3)) % 3, '=')...
CWE-787
24
QInt16() {}
CWE-908
48
vector <string> genECDSAKey() { vector<char> errMsg(BUF_LEN, 0); int errStatus = 0; vector <uint8_t> encr_pr_key(BUF_LEN, 0); vector<char> pub_key_x(BUF_LEN, 0); vector<char> pub_key_y(BUF_LEN, 0); uint32_t enc_len = 0; sgx_status_t status = trustedGenerateEcdsaKeyAES(eid, &errStatus, ...
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { auto* params = reinterpret_cast<TfLiteLSHProjectionParams*>(node->builtin_data); int32_t* out_buf = GetOutput(context, node, 0)->data.i32; const TfLiteTensor* hash = GetInput(context, node, 0); const TfLiteTensor* input = GetInput(context, nod...
CWE-787
24
MONGO_EXPORT int bson_append_element( bson *b, const char *name_or_null, const bson_iterator *elem ) { bson_iterator next = *elem; int size; bson_iterator_next( &next ); size = next.cur - elem->cur; if ( name_or_null == NULL ) { if( bson_ensure_space( b, size ) == BSON_ERROR ) ...
CWE-190
19
void *jas_realloc(void *ptr, size_t size) { void *result; JAS_DBGLOG(101, ("jas_realloc called with %x,%zu\n", ptr, size)); result = realloc(ptr, size); JAS_DBGLOG(100, ("jas_realloc(%p, %zu) -> %p\n", ptr, size, result)); return result; }
CWE-190
19
bool hex2carray(const char *_hex, uint64_t *_bin_len, uint8_t *_bin, uint64_t _max_length) { CHECK_STATE(_hex); CHECK_STATE(_bin); CHECK_STATE(_bin_len) int len = strnlen(_hex, 2 * _max_length + 1); CHECK_STATE(len != 2 * _max_length + 1); CHECK_STATE(len <= 2 * _max_lengt...
CWE-787
24
const String& setSize(int len) { assertx(m_str); m_str->setSize(len); return *this; }
CWE-125
47
TfLiteStatus ReverseSequenceImpl(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); const TfLiteTensor* seq_lengths_tensor = GetInput(context, node, kSeqLengthsTensor); const TS* seq_lengths = GetTensorData<TS>(seq_lengths_tensor); auto* params ...
CWE-787
24
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-787
24
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-787
24
void BlockCodec::runPull() { AFframecount framesToRead = m_outChunk->frameCount; AFframecount framesRead = 0; assert(framesToRead % m_framesPerPacket == 0); int blockCount = framesToRead / m_framesPerPacket; // Read the compressed data. ssize_t bytesRead = read(m_inChunk->buffer, m_bytesPerPacket * blockCount);...
CWE-190
19
void TileManager::crop( RawTile *ttt ){ int tw = image->getTileWidth(); int th = image->getTileHeight(); if( loglevel >= 5 ){ *logfile << "TileManager :: Edge tile: Base size: " << tw << "x" << th << ": This tile: " << ttt->width << "x" << ttt->height << endl; } // Create a new buffer, fill...
CWE-190
19
void onComplete(const Status& status, ContextImpl& context) const override { auto& completion_state = context.getCompletionState(this); if (completion_state.is_completed_) { return; } // If any of children is OK, return OK if (Status::Ok == status) { completion_state.is_completed_ = t...
CWE-303
89
TfLiteRegistration GetPassthroughOpRegistration() { TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr}; reg.init = [](TfLiteContext* context, const char*, size_t) -> void* { auto* first_new_tensor = new int; context->AddTensors(context, 2, first_new_tensor); return first_new_tensor; }; re...
CWE-787
24
selaGetCombName(SELA *sela, l_int32 size, l_int32 direction) { char *selname; char combname[L_BUF_SIZE]; l_int32 i, nsels, sx, sy, found; SEL *sel; PROCNAME("selaGetCombName"); if (!sela) return (char *)ERROR_PTR("sela not defined", procName, NULL); ...
CWE-787
24
ResourceHandle::ResourceHandle(const ResourceHandleProto& proto) { FromProto(proto); }
CWE-617
51
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-125
47
PlainPasswd::PlainPasswd(int len) : CharArray(len) { }
CWE-787
24
PackLinuxElf64::elf_find_dynamic(unsigned int key) const { Elf64_Dyn const *dynp= dynseg; if (dynp) for (; (unsigned)((char const *)dynp - (char const *)dynseg) < sz_dynseg && Elf64_Dyn::DT_NULL!=dynp->d_tag; ++dynp) if (get_te64(&dynp->d_tag)==key) { upx_uint64_t const t= elf_get_offset...
CWE-190
19
optional<ARN> ARN::parse(const string& s, bool wildcards) { static const char str_wild[] = "arn:([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)"; static const regex rx_wild(str_wild, sizeof(str_wild) - 1, ECMAScript | optimize); static const char str_no_wild[] = "arn:([^:*]*):([^:*]*):([^:*]*):([^:*]*...
CWE-617
51
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE_EQ(context, NumInputs(node), 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); const TfLiteTensor* dims = GetInput(context, node, kDimsTensor); const TfLiteTensor* value = GetInput(context, node, kValueTensor); // Make sure t...
CWE-125
47
const FieldID& activeUnionMemberId(const void* object, ptrdiff_t offset) { return *reinterpret_cast<const FieldID*>( offset + static_cast<const char*>(object)); }
CWE-763
61
Status DoCompute(OpKernelContext* ctx) { tensorflow::ResourceTagger tag(kTFDataResourceTag, ctx->op_kernel().type_string()); tstring filename; TF_RETURN_IF_ERROR( ParseScalarArgument<tstring>(ctx, "filename", &filename)); tstring compression_type; TF_RETU...
CWE-787
24
string gen_dkg_poly(int _t) { vector<char> errMsg(BUF_LEN, 0); int errStatus = 0; uint32_t enc_len = 0; vector <uint8_t> encrypted_dkg_secret(BUF_LEN, 0); sgx_status_t status = trustedGenDkgSecretAES(eid, &errStatus, errMsg.data(), encrypted_dkg_secret.data(), &enc_len, _t); HANDLE_TRUSTED_F...
CWE-787
24
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) { const TfLiteTensor* input = GetInput(context, node, kInputTensor); TfLiteTensor* output = GetOutput(context, node, kOutputTensor); const TfLiteTensor* multipliers = GetInput(context, node, kInputMultipliers); if (IsDynamicTensor(output)) { TF_LI...
CWE-125
47
TfLiteStatus EvalImpl(TfLiteContext* context, const TfLiteTensor* input, TfLiteNode* node) { // Map from value, to index in the unique elements vector. // Note that we prefer to use map than unordered_map as it showed less // increase in the binary size. std::map<T, int> unique_values; T...
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-125
47
void* sspi_SecureHandleGetUpperPointer(SecHandle* handle) { void* pointer; if (!handle) return NULL; pointer = (void*) ~((size_t) handle->dwUpper); return pointer; }
CWE-476
46
Http::FilterMetadataStatus Context::onResponseMetadata() { if (!wasm_->onResponseMetadata_) { return Http::FilterMetadataStatus::Continue; } if (wasm_->onResponseMetadata_(this, id_).u64_ == 0) { return Http::FilterMetadataStatus::Continue; } return Http::FilterMetadataStatus::Continue; // This is cur...
CWE-476
46
void CalculateOutputIndexValueRowID( 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(); result->reserve(index...
CWE-131
88