code stringlengths 12 2.05k | label_name stringlengths 6 8 | label int64 0 95 |
|---|---|---|
public void testRenameTo() throws Exception {
TestHttpData test = new TestHttpData("test", UTF_8, 0);
try {
File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
tmpFile.deleteOnExit();
final int totalByteCount = 4096;
byte[] bytes ... | CWE-379 | 83 |
public NettyHttpHeaders() {
this.nettyHeaders = new DefaultHttpHeaders(false);
this.conversionService = ConversionService.SHARED;
} | CWE-444 | 41 |
public void setProperty(String name, Object value) throws SAXException {
getXMLReader().setProperty(name, value);
} | CWE-611 | 13 |
public VFSLeaf createChildLeaf(String name) {
File fNewFile = new File(getBasefile(), name);
try {
if(!fNewFile.getParentFile().exists()) {
fNewFile.getParentFile().mkdirs();
}
if (!fNewFile.createNewFile()) {
log.warn("Could not create a new leaf::" + name + " in container::" + getBasefile().getA... | CWE-22 | 2 |
public static final Binder fromPath(Path path)
throws IOException {
try(InputStream inStream = Files.newInputStream(path)) {
return (Binder)myStream.fromXML(inStream);
} catch (Exception e) {
log.error("Cannot import this map: " + path, e);
return null;
}
} | CWE-91 | 78 |
public void testUpdateMapper_serializade_withExpirationDate() {
//create a mapper
String mapperId = UUID.randomUUID().toString();
String sessionId = UUID.randomUUID().toString().substring(0, 32);
PersistentMapper sMapper = new PersistentMapper("mapper-to-persist-until");
PersistedMapper pMapper = mapperDao.p... | CWE-91 | 78 |
public void testLoadMapper_serializade() {
//create a mapper
String mapperId = UUID.randomUUID().toString();
String sessionId = UUID.randomUUID().toString().substring(0, 32);
PersistentMapper sMapper = new PersistentMapper("mapper-to-persist");
PersistedMapper pMapper = mapperDao.persistMapper(sessionId, map... | CWE-91 | 78 |
public Operation.OperationResult executeFixedCostOperation(
final MessageFrame frame, final EVM evm) {
Bytes shiftAmount = frame.popStackItem();
if (shiftAmount.size() > 4 && (shiftAmount = shiftAmount.trimLeadingZeros()).size() > 4) {
frame.popStackItem();
frame.pushStackItem(UInt256.ZERO);... | CWE-681 | 59 |
public static String compileMustache(Map<String, Object> context, String template) {
if (context == null || StringUtils.isBlank(template)) {
return "";
}
Writer writer = new StringWriter();
try {
Mustache.compiler().escapeHTML(false).emptyStringIsFalse(true).compile(template).execute(context, writer);
... | CWE-79 | 1 |
public void testSetRequestMethod() {
HttpURLConnection conn = createHttpUrlConnection(convertToUrl(TEST_URL), "", 0, "", "");
Utils.setRequestMethod(conn, Utils.RequestMethod.POST);
Assert.assertEquals(conn.getRequestMethod(), "POST");
} | CWE-306 | 79 |
CreateCommentResponse saveComment() {
CreateCommentRequest createCommentRequest = ZrLogUtil.convertRequestParam(getRequest().getParameterMap(), CreateCommentRequest.class);
createCommentRequest.setIp(WebTools.getRealIp(getRequest()));
createCommentRequest.setUserAgent(getHeader("User-Agent")... | CWE-79 | 1 |
public void testMatchUse() {
JWKMatcher matcher = new JWKMatcher.Builder().keyUse(KeyUse.ENCRYPTION).build();
assertTrue(matcher.matches(new RSAKey.Builder(new Base64URL("n"), new Base64URL("e")).keyID("1").keyUse(KeyUse.ENCRYPTION).build()));
assertFalse(matcher.matches(new ECKey.Builder(ECKey.Curve.P_256, ne... | CWE-347 | 25 |
public String getHeader(String name) {
//logger.info("Ineader .. parameter .......");
String value = super.getHeader(name);
if (value == null)
return null;
//logger.info("Ineader RequestWrapper ........... value ....");
return cleanXSS(value);
} | CWE-79 | 1 |
public static Object deserialize(byte[] data)
throws IOException, ClassNotFoundException
{
ByteArrayInputStream in = new ByteArrayInputStream(data);
ObjectInputStream is = new ObjectInputStream(in);
return is.readObject();
} | CWE-470 | 84 |
public void encodeByteArrayDeepInJson() throws JSONException {
JSONObject data = new JSONObject("{a: \"hi\", b: {}, c: {a: \"bye\", b: {}}}");
data.getJSONObject("b").put("why", new byte[3]);
data.getJSONObject("c").getJSONObject("b").put("a", new byte[6]);
Packet<JSONObject> packet... | CWE-476 | 46 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-125 | 47 |
public void headerMultipleContentLengthValidationShouldPropagate() {
LastInboundHandler inboundHandler = new LastInboundHandler();
request.addLong(HttpHeaderNames.CONTENT_LENGTH, 0);
request.addLong(HttpHeaderNames.CONTENT_LENGTH, 1);
Http2StreamChannel channel = newInboundStream(3, ... | CWE-444 | 41 |
private static boolean nameContainsForbiddenSequence(String name) {
boolean result = false;
if (name != null) {
name = name.toLowerCase();
result = name.startsWith(".") ||
name.contains("../") ||
name.contains("..\\") ||
... | CWE-22 | 2 |
public Optional<URL> getResource(String path) {
boolean isDirectory = isDirectory(path);
if (!isDirectory) {
URL url = classLoader.getResource(prefixPath(path));
return Optional.ofNullable(url);
}
return Optional.empty();
} | CWE-22 | 2 |
public void write(byte[] b, int offset, int length) throws IOException {
if (b == null) {
throw new NullPointerException();
}
if (offset < 0 || offset + length > b.length) {
throw new ArrayIndexOutOfBoundsException();
}
write(fd, b, offset, length);
} | CWE-787 | 24 |
private String marshallToString(Document document) throws TransformerException {
StringWriter sw = new StringWriter();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.transform(new DOMSource(document), new StreamResult(sw));
retu... | CWE-611 | 13 |
public void encodeByteArray2() {
Packet<byte[]> packet = new Packet<>(Parser.BINARY_EVENT);
packet.data = new byte[2];
packet.id = 0;
packet.nsp = "/";
Helpers.testBin(packet);
} | CWE-476 | 46 |
public void onTaskSelectionEvent(@Observes TaskSelectionEvent event){
selectedTaskId = event.getTaskId();
selectedTaskName = event.getTaskName();
view.getTaskIdAndName().setText(String.valueOf(selectedTaskId) + " - "+selectedTaskName);
view.getContent().clear();
... | CWE-79 | 1 |
ReservedChar(int rawChar, String percentEncodedChar, byte marker) {
this.rawChar = rawChar;
this.percentEncodedChar = percentEncodedChar;
this.marker = marker;
} | CWE-22 | 2 |
public void testCurveCheckNegative_P256_attackPt2()
throws Exception {
// The malicious JWE contains a public key with order 2447
String maliciousJWE = "eyJhbGciOiJFQ0RILUVTK0ExMjhLVyIsImVuYyI6IkExMjhDQkMtSFMyNTYiLCJlcGsiOnsia3R5IjoiRUMiLCJ4IjoiWE9YR1E5XzZRQ3ZCZzN1OHZDSS1VZEJ2SUNBRWNOTkJyZnFkN3RHN29RNCIsInkiO... | CWE-347 | 25 |
public SpotProtocolDecoder(Protocol protocol) {
super(protocol);
try {
documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
xPath = XPathFactory.newInstance().newXPath();
messageExpression = xPath.compile("//messageList/message");
}... | CWE-611 | 13 |
void equal() {
final PathAndQuery res = PathAndQuery.parse("/=?a=b=1");
assertThat(res).isNotNull();
assertThat(res.path()).isEqualTo("/=");
assertThat(res.query()).isEqualTo("a=b=1");
// '%3D' in a query string should never be decoded into '='.
final PathAndQuery re... | CWE-22 | 2 |
protected Class<?> getClassForNode(Node node) {
Class<?> type = node.getType();
if (type.getAnnotation(Editable.class) != null && !ClassUtils.isConcrete(type)) {
ImplementationRegistry registry = OneDev.getInstance(ImplementationRegistry.class);
for (Class<?> implementationClass: registry.getImpleme... | CWE-502 | 15 |
public void setStringInternEnabled(boolean stringInternEnabled) {
this.stringInternEnabled = stringInternEnabled;
} | CWE-611 | 13 |
private static boolean appendOneByte(Bytes buf, int cp, boolean wasSlash, boolean isPath) {
if (cp == 0x7F) {
// Reject the control character: 0x7F
return false;
}
if (cp >>> 5 == 0) {
// Reject the control characters: 0x00..0x1F
if (isPath) {... | CWE-22 | 2 |
public BCXMSSPrivateKey(PrivateKeyInfo keyInfo)
throws IOException
{
XMSSKeyParams keyParams = XMSSKeyParams.getInstance(keyInfo.getPrivateKeyAlgorithm().getParameters());
this.treeDigest = keyParams.getTreeDigest().getAlgorithm();
XMSSPrivateKey xmssPrivateKey = XMSSPrivateKey.... | CWE-502 | 15 |
public RainbowParameters(int[] vi)
{
this.vi = vi;
try
{
checkParams();
}
catch (Exception e)
{
e.printStackTrace();
}
} | CWE-470 | 84 |
private String stripComments(String theScript) {
return BLOCK_COMMENT_STRIPPER.matcher(theScript).replaceAll("");
} | CWE-94 | 14 |
void colon() {
assertThat(PathAndQuery.parse("/:")).isNotNull();
assertThat(PathAndQuery.parse("/:/")).isNotNull();
assertThat(PathAndQuery.parse("/a/:")).isNotNull();
assertThat(PathAndQuery.parse("/a/:/")).isNotNull();
} | CWE-22 | 2 |
public void resetPassword(UserReference userReference, String newPassword)
throws ResetPasswordException
{
this.checkUserReference(userReference);
XWikiContext context = this.contextProvider.get();
DocumentUserReference documentUserReference = (DocumentUserReference) userReferen... | CWE-640 | 20 |
public void setSetContentFromFileExceptionally() throws Exception {
final long maxSize = 4;
DiskFileUpload f1 = new DiskFileUpload("file5", "file5", "application/json", null, null, 0);
f1.setMaxSize(maxSize);
try {
f1.setContent(Unpooled.wrappedBuffer(new byte[(int) maxSi... | CWE-378 | 80 |
private static void appendHexNibble(StringBuilder buf, int nibble) {
if (nibble < 10) {
buf.append((char) ('0' + nibble));
} else {
buf.append((char) ('A' + nibble - 10));
}
} | CWE-22 | 2 |
public void shouldNotAllowToListFileOutsideRoot() throws Exception {
// given
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage(containsString("this String argument must not contain the substring [..]"));
// when
logViewEndpoint.view("... | CWE-22 | 2 |
public void setIncludeInternalDTDDeclarations(boolean include) {
this.includeInternalDTDDeclarations = include;
} | CWE-611 | 13 |
protected int addFileNames(String[] file) { // This appears to only be used by unit tests
for (int i = 0; file != null && i < file.length; i++) {
workUnitList.add(new WorkUnit(file[i]));
}
return size();
} | CWE-502 | 15 |
private JWTClaimsSet fetchOidcProfile(BearerAccessToken accessToken) {
final var userInfoRequest = new UserInfoRequest(configuration.findProviderMetadata().getUserInfoEndpointURI(),
accessToken);
final var userInfoHttpRequest = userInfoRequest.toHTTPRequest();
configuration.confi... | CWE-347 | 25 |
public InvalidExtensionException(String[] allowedExtension, String extension, String filename)
{
super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]");
this.allowedExtension = allowedExtension;
this.ex... | CWE-79 | 1 |
public ClassPathResource(String path, ClassLoader classLoader) {
Assert.notNull(path, "Path must not be null");
Assert.state(doesNotContainFileColon(path), "Path must not contain 'file:'");
String pathToUse = StringUtils.cleanPath(path);
if (pathToUse.startsWith("/")) {
... | CWE-22 | 2 |
protected String getContent(SxSource sxSource, FilesystemExportContext exportContext)
{
String content;
// We know we're inside a SX file located at "<S|J>sx/<Space>/<Page>/<s|j>sx<NNN>.<css|js>". Inside this CSS
// there can be URLs and we need to ensure that the prefix for these URLs ... | CWE-22 | 2 |
public static HColor unlinear(HColor color1, HColor color2, int completion) {
if (completion == 0) {
return color1;
}
if (completion == 100) {
return color2;
}
if (color1 instanceof HColorSimple && color2 instanceof HColorSimple) {
return HColorSimple.unlinear((HColorSimple) color1, (HColorSimple) c... | CWE-918 | 16 |
function findLateSubscriptionSortedByPriority() {
if (late_subscriptions.length === 0) {
return null;
}
late_subscriptions.sort(compare_subscriptions);
// istanbul ignore next
if (doDebug) {
debugLog(
... | CWE-770 | 37 |
public Mapper retrieveMapperById(String mapperId) {
List<PersistedMapper> mappers = dbInstance.getCurrentEntityManager()
.createNamedQuery("loadMapperByKey", PersistedMapper.class)
.setParameter("mapperId", mapperId)
.getResultList();
PersistedMapper pm = mappers.isEmpty() ? null : mappers.get(0);
... | CWE-91 | 78 |
final protected FontConfiguration getFontConfiguration() {
if (UseStyle.useBetaStyle() == false)
return FontConfiguration.create(skinParam, FontParam.TIMING, null);
return FontConfiguration.create(skinParam, StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram)
.getMergedStyle(skinParam.get... | CWE-918 | 16 |
public int decryptWithAd(byte[] ad, byte[] ciphertext,
int ciphertextOffset, byte[] plaintext, int plaintextOffset,
int length) throws ShortBufferException, BadPaddingException {
int space;
if (ciphertextOffset > ciphertext.length)
space = 0;
else
space = ciphertext.length - ciphertextOffset;
if (l... | CWE-787 | 24 |
public void testWhitespaceBeforeTransferEncoding01() {
String requestStr = "GET /some/path HTTP/1.1\r\n" +
" Transfer-Encoding : chunked\r\n" +
"Content-Length: 1\r\n" +
"Host: netty.io\r\n\r\n" +
"a";
testInvalidHeaders0(requestStr);
... | CWE-444 | 41 |
public void testSetContentFromFile() throws Exception {
TestHttpData test = new TestHttpData("test", UTF_8, 0);
try {
File tmpFile = File.createTempFile(UUID.randomUUID().toString(), ".tmp");
tmpFile.deleteOnExit();
FileOutputStream fos = new FileOutputStream(tmpF... | CWE-378 | 80 |
private void ondata(byte[] data) {
try {
this.decoder.add(data);
} catch (DecodingException e) {
this.onerror(e);
}
} | CWE-476 | 46 |
public static boolean saveLinkList(HashMap<String, PortletInstitution> portletMap){
XStream xstream = XStreamHelper.createXStreamInstance();
xstream.alias("LinksPortlet", Map.class);
xstream.alias(ELEM_LINK, PortletLink.class);
xstream.alias(ELEM_INSTITUTION, PortletInstitution.class);
xstream.aliasAttribute... | CWE-91 | 78 |
public static void fillArticleInfo(Log data, HttpServletRequest request, String suffix) {
data.put("alias", data.get("alias") + suffix);
data.put("url", WebTools.getHomeUrl(request) + Constants.getArticleUri() + data.get("alias"));
data.put("noSchemeUrl", WebTools.getHomeUrlWithHost(request)... | CWE-79 | 1 |
public void testPrivateKeyParsingSHA256()
throws IOException, ClassNotFoundException
{
XMSSMTParameters params = new XMSSMTParameters(20, 10, new SHA256Digest());
XMSSMT mt = new XMSSMT(params, new SecureRandom());
mt.generateKeys();
byte[] privateKey = mt.exportPrivateKe... | CWE-470 | 84 |
private static boolean doesNotContainFileColon(String path) {
return !path.contains("file:");
} | CWE-22 | 2 |
public void toScientificString(StringBuilder result) {
assert(!isApproximate);
if (isNegative()) {
result.append('-');
}
if (precision == 0) {
result.append("0E+0");
return;
}
// NOTE: It is not safe to add to lOptPos (aka maxInt) o... | CWE-190 | 19 |
public void error(SAXParseException e) {
} | CWE-611 | 13 |
private File tempFile() throws IOException {
String newpostfix;
String diskFilename = getDiskFilename();
if (diskFilename != null) {
newpostfix = '_' + diskFilename;
} else {
newpostfix = getPostfix();
}
File tmpFile;
if (getBaseDirecto... | CWE-378 | 80 |
public void setSetContentFromFileExceptionally() throws Exception {
final long maxSize = 4;
DiskFileUpload f1 = new DiskFileUpload("file5", "file5", "application/json", null, null, 0);
f1.setMaxSize(maxSize);
try {
f1.setContent(Unpooled.wrappedBuffer(new byte[(int) maxSi... | CWE-379 | 83 |
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-787 | 24 |
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-125 | 47 |
TfLiteStatus PrepareHashtableSize(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input_resource_id_tensor =
GetInput(context, node, kInputResourceIdTensor);
TF_LITE_ENSURE_EQ(context, input_r... | CWE-125 | 47 |
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-125 | 47 |
Status CreateTempFile(Env* env, float value, uint64 size, string* filename) {
const string dir = testing::TmpDir();
*filename = io::JoinPath(dir, strings::StrCat("file_", value));
std::unique_ptr<WritableFile> file;
TF_RETURN_IF_ERROR(env->NewWritableFile(*filename, &file));
for (uint64 i = 0; i < size; ++i) ... | CWE-125 | 47 |
R_API RBinJavaAttrInfo *r_bin_java_source_code_file_attr_new(RBinJavaObj *bin, ut8 *buffer, ut64 sz, ut64 buf_offset) {
if (!sz) {
return NULL;
}
ut64 offset = 0;
RBinJavaAttrInfo *attr = r_bin_java_default_attr_new (bin, buffer, sz, buf_offset);
offset += 6;
if (!attr) {
return NULL;
}
attr->type = R_BIN_J... | CWE-805 | 63 |
int TLSOutStream::writeTLS(const U8* data, int length)
{
int n;
n = gnutls_record_send(session, data, length);
if (n == GNUTLS_E_INTERRUPTED || n == GNUTLS_E_AGAIN)
return 0;
if (n < 0)
throw TLSException("writeTLS", n);
return n;
} | CWE-787 | 24 |
bool PamBackend::start(const QString &user) {
bool result;
QString service = QStringLiteral("sddm");
if (user == QStringLiteral("sddm") && m_greeter)
service = QStringLiteral("sddm-greeter");
else if (m_app->session()->path().isEmpty())
service = QStringLite... | CWE-613 | 7 |
AuthenticationFeature::AuthenticationFeature(application_features::ApplicationServer& server)
: ApplicationFeature(server, "Authentication"),
_userManager(nullptr),
_authCache(nullptr),
_authenticationUnixSockets(true),
_authenticationSystemOnly(true),
_localAuthentication(true),
... | CWE-613 | 7 |
int FdInStream::pos()
{
return offset + ptr - start;
} | CWE-787 | 24 |
void fx_DataView(txMachine* the)
{
txSlot* slot;
txBoolean flag = 0;
txInteger offset, size;
txSlot* info;
txSlot* instance;
txSlot* view;
txSlot* buffer;
if (mxIsUndefined(mxTarget))
mxTypeError("call: DataView");
if ((mxArgc > 0) && (mxArgv(0)->kind == XS_REFERENCE_KIND)) {
slot = mxArgv(0)->value.refere... | CWE-125 | 47 |
QString Helper::temporaryMountDevice(const QString &device, const QString &name, bool readonly)
{
QString mount_point = mountPoint(device);
if (!mount_point.isEmpty())
return mount_point;
mount_point = "%1/.%2/mount/%3";
const QStringList &tmp_paths = QStandardPaths::standardLocations(QStandar... | CWE-59 | 36 |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
int num_inputs = NumInputs(node);
TF_LITE_ENSURE(context, num_inputs >= 2);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
const TfLiteTensor* input1 = GetInput(context, node, kInputTensor1);
TfLiteTensor* output = GetOutput(context, node, kO... | CWE-125 | 47 |
TEST_F(ZNCTest, AwayNotify) {
auto znc = Run();
auto ircd = ConnectIRCd();
auto client = ConnectClient();
client.Write("CAP LS");
client.Write("PASS :hunter2");
client.Write("NICK nick");
client.Write("USER user/test x x :x");
QByteArray cap_ls;
client.ReadUntilAndGet(" LS :", cap_ls... | CWE-476 | 46 |
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) {
if (output.size... | CWE-681 | 59 |
inline void skip(int bytes) {
while (bytes > 0) {
int n = check(1, bytes);
ptr += n;
bytes -= n;
}
} | CWE-787 | 24 |
int FdInStream::readWithTimeoutOrCallback(void* buf, int len, bool wait)
{
struct timeval before, after;
if (timing)
gettimeofday(&before, 0);
int n;
while (true) {
do {
fd_set fds;
struct timeval tv;
struct timeval* tvp = &tv;
if (!wait) {
tv.tv_sec = tv.tv_usec = 0;
... | CWE-787 | 24 |
void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val)
{
int i;
int j;
jas_seqent_t *rowstart;
int rowstep;
jas_seqent_t *data;
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 |
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
TF_LITE_ENSURE_EQ(context, NumInputs(node), 3);
TF_LITE_ENSURE_EQ(context, NumOutputs(node), 2);
const TfLiteTensor* lookup = GetInput(context, node, 0);
TF_LITE_ENSURE_EQ(context, NumDimensions(lookup), 1);
TF_LITE_ENSURE_EQ(context, lookup->t... | 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 |
NO_INLINE JsVar *jspeFactorDelete() {
JSP_ASSERT_MATCH(LEX_R_DELETE);
JsVar *parent = 0;
JsVar *a = jspeFactorMember(jspeFactor(), &parent);
JsVar *result = 0;
if (JSP_SHOULD_EXECUTE) {
bool ok = false;
if (jsvIsName(a) && !jsvIsNewChild(a)) {
// if no parent, check in root?
if (!parent &&... | CWE-787 | 24 |
void test_base64_lengths(void)
{
const char *in = "FuseMuse";
char out1[32];
char out2[32];
size_t enclen;
int declen;
/* Encoding a zero-length string should fail */
enclen = mutt_b64_encode(out1, in, 0, 32);
if (!TEST_CHECK(enclen == 0))
{
TEST_MSG("Expected: %zu", 0);
TEST_MSG("Actual : %... | CWE-120 | 44 |
TfLiteStatus MockCustom::Invoke(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input = tflite::GetInput(context, node, 0);
const int32_t* input_data = input->data.i32;
const TfLiteTensor* weight = tflite::GetInput(context, node, 1);
const uint8_t* weight_data = weight->data.uint8;
TfLiteTenso... | CWE-125 | 47 |
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-125 | 47 |
FdInStream::FdInStream(int fd_, int timeoutms_, int bufSize_,
bool closeWhenDone_)
: fd(fd_), closeWhenDone(closeWhenDone_),
timeoutms(timeoutms_), blockCallback(0),
timing(false), timeWaitedIn100us(5), timedKbits(0),
bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
{
pt... | CWE-787 | 24 |
TfLiteStatus GenericPrepare(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, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
TF_LITE_ENSURE_TYPES_EQ(context, ... | 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-787 | 24 |
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-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-787 | 24 |
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-125 | 47 |
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-787 | 24 |
int GetU8 (int nPos, bool *pbSuccess)
{
//*pbSuccess = true;
if ( nPos < 0 || nPos >= m_nLen )
{
*pbSuccess = false;
return 0;
}
return m_sFile[ nPos ];
} | CWE-787 | 24 |
int FdOutStream::writeWithTimeout(const void* data, int length, int timeoutms)
{
int n;
do {
fd_set fds;
struct timeval tv;
struct timeval* tvp = &tv;
if (timeoutms != -1) {
tv.tv_sec = timeoutms / 1000;
tv.tv_usec = (timeoutms % 1000) * 1000;
} else {
tvp = NULL;
}
... | CWE-787 | 24 |
TfLiteStatus HardSwishEval(TfLiteContext* context, TfLiteNode* node) {
HardSwishData* data = static_cast<HardSwishData*>(node->user_data);
const TfLiteTensor* input = GetInput(context, node, 0);
TfLiteTensor* output = GetOutput(context, node, 0);
switch (input->type) {
case kTfLiteFloat32: {
if (kern... | CWE-787 | 24 |
int FdOutStream::length()
{
return offset + ptr - sentUpTo;
} | CWE-787 | 24 |
static TfLiteRegistration DynamicCopyOpRegistration() {
TfLiteRegistration reg = {nullptr, nullptr, nullptr, nullptr};
reg.prepare = [](TfLiteContext* context, TfLiteNode* node) {
// Output 0 is dynamic
TfLiteTensor* output0 = GetOutput(context, node, 0);
SetTensorToDynamic(output0);
... | CWE-125 | 47 |
inline int StringData::size() const { return m_len; } | CWE-787 | 24 |
static int decode_level3_header(LHAFileHeader **header, LHAInputStream *stream)
{
unsigned int header_len;
// The first field at the start of a level 3 header is supposed to
// indicate word size, with the idea being that the header format
// can be extended beyond 32-bit words in the future. In practise,
// noth... | CWE-190 | 19 |
int64_t OutputFile::readImpl(char* /*buffer*/, int64_t /*length*/) {
raise_warning("cannot read from a php://output stream");
return -1;
} | CWE-125 | 47 |
TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLitePackParams* data =
reinterpret_cast<TfLitePackParams*>(node->builtin_data);
TfLiteTensor* output = GetOutput(context, node, kOutputTensor);
switch (output->type) {
case kTfLiteFloat32: {
return PackImpl<float>(context, node... | CWE-787 | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.