instruction string | input string | output string | cwe_ids list | cve_id string | severity string | cvss_score float64 | repo_name string | func_name string | file_path string | commit_hash string | is_vulnerable int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Analyze the following code function for security vulnerabilities | private DocumentReference getCurrentUser(Right right, EntityReference entity)
{
// Backward compatibility for the old way of assigning programming right.
if (CONTENT_AUTHOR_RIGHTS.contains(right)) {
XWikiDocument doc = entity == null ? getProgrammingDocument() : getDocument(entity);
if (doc != null) {
return getContentAuthor(doc);
}
}
return this.xcontextProvider.get().getUserReference();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getCurrentUser
File: xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-bridge/src/main/java/org/xwiki/security/authorization/internal/DefaultContextualAuthorizationManager.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-459"
] | CVE-2023-36468 | HIGH | 8.8 | xwiki/xwiki-platform | getCurrentUser | xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-authorization/xwiki-platform-security-authorization-bridge/src/main/java/org/xwiki/security/authorization/internal/DefaultContextualAuthorizationManager.java | 15a6f845d8206b0ae97f37aa092ca43d4f9d6e59 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void startSystemLockTaskMode(int taskId) throws RemoteException {
mActivityTaskManager.startSystemLockTaskMode(taskId);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: startSystemLockTaskMode
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21292 | MEDIUM | 5.5 | android | startSystemLockTaskMode | services/core/java/com/android/server/am/ActivityManagerService.java | d10b27e539f7bc91c2360d429b9d05f05274670d | 0 |
Analyze the following code function for security vulnerabilities | public void removeCharacterDataChangeListener(final CharacterDataChangeListener listener) {
WebAssert.notNull("listener", listener);
synchronized (listeners_lock_) {
if (characterDataListeners_ != null) {
characterDataListeners_.remove(listener);
characterDataListenersList_ = null;
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: removeCharacterDataChangeListener
File: src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java
Repository: HtmlUnit/htmlunit
The code follows secure coding practices. | [
"CWE-787"
] | CVE-2023-2798 | HIGH | 7.5 | HtmlUnit/htmlunit | removeCharacterDataChangeListener | src/main/java/com/gargoylesoftware/htmlunit/html/DomNode.java | 940dc7fd | 0 |
Analyze the following code function for security vulnerabilities | private boolean isPackageAccessForbidden(String pkg) {
return SecurityConstants.PACKAGE_USE_BLACKLIST.stream().anyMatch(pkg::startsWith)
|| (isPackageBlacklisted(pkg) && !isPackageWhitelisted(pkg));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isPackageAccessForbidden
File: src/main/java/de/tum/in/test/api/security/ArtemisSecurityManager.java
Repository: ls1intum/Ares
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2024-23683 | HIGH | 8.2 | ls1intum/Ares | isPackageAccessForbidden | src/main/java/de/tum/in/test/api/security/ArtemisSecurityManager.java | af4f28a56e2fe600d8750b3b415352a0a3217392 | 0 |
Analyze the following code function for security vulnerabilities | public void setSimpleMode(boolean val) {
simpleMode = val;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setSimpleMode
File: src/main/java/emissary/pickup/WorkBundle.java
Repository: NationalSecurityAgency/emissary
The code follows secure coding practices. | [
"CWE-502"
] | CVE-2021-32634 | MEDIUM | 6.5 | NationalSecurityAgency/emissary | setSimpleMode | src/main/java/emissary/pickup/WorkBundle.java | 40260b1ec1f76cc92361702cc14fa1e4388e19d7 | 0 |
Analyze the following code function for security vulnerabilities | @Nullable
private ParcelFileDescriptor getShortcutIconParcelFileDescriptor(
@Nullable final ShortcutPackage p, @Nullable final ShortcutInfo shortcutInfo) {
if (p == null || shortcutInfo == null || !shortcutInfo.hasIconFile()) {
return null;
}
final String path = p.getBitmapPathMayWait(shortcutInfo);
if (path == null) {
Slog.w(TAG, "null bitmap detected in getShortcutIconFd()");
return null;
}
try {
return ParcelFileDescriptor.open(
new File(path),
ParcelFileDescriptor.MODE_READ_ONLY);
} catch (FileNotFoundException e) {
Slog.e(TAG, "Icon file not found: " + path);
return null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getShortcutIconParcelFileDescriptor
File: services/core/java/com/android/server/pm/ShortcutService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-40079 | HIGH | 7.8 | android | getShortcutIconParcelFileDescriptor | services/core/java/com/android/server/pm/ShortcutService.java | 96e0524c48c6e58af7d15a2caf35082186fc8de2 | 0 |
Analyze the following code function for security vulnerabilities | protected boolean isAllowed(DocumentReference resultDocumentReference, List<DocumentReference> usersToCheck)
{
for (DocumentReference user : usersToCheck) {
if (!this.authorization.hasAccess(Right.VIEW, user, resultDocumentReference)) {
return false;
}
}
return true;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isAllowed
File: xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-query/src/main/java/org/xwiki/query/solr/internal/SolrQueryExecutor.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-285"
] | CVE-2023-48241 | HIGH | 7.5 | xwiki/xwiki-platform | isAllowed | xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-query/src/main/java/org/xwiki/query/solr/internal/SolrQueryExecutor.java | 93b8ec702d7075f0f5794bb05dfb651382596764 | 0 |
Analyze the following code function for security vulnerabilities | private void offerEncryptedWriteRequest(MessageEvent encryptedWrite) {
final boolean locked = pendingEncryptedWritesLock.tryLock();
try {
pendingEncryptedWrites.add(encryptedWrite);
} finally {
if (locked) {
pendingEncryptedWritesLock.unlock();
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: offerEncryptedWriteRequest
File: src/main/java/org/jboss/netty/handler/ssl/SslHandler.java
Repository: netty
The code follows secure coding practices. | [
"CWE-119"
] | CVE-2014-3488 | MEDIUM | 5 | netty | offerEncryptedWriteRequest | src/main/java/org/jboss/netty/handler/ssl/SslHandler.java | 2fa9400a59d0563a66908aba55c41e7285a04994 | 0 |
Analyze the following code function for security vulnerabilities | public static String getBuildTimestamp() {
return BUILD_TIMESTAMP;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getBuildTimestamp
File: modules/library/metadata/src/main/java/org/geotools/util/factory/GeoTools.java
Repository: geotools
The code follows secure coding practices. | [
"CWE-917"
] | CVE-2022-24818 | HIGH | 7.5 | geotools | getBuildTimestamp | modules/library/metadata/src/main/java/org/geotools/util/factory/GeoTools.java | 4f70fa3234391dd0cda883a20ab0ec75688cba49 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean getMasterSyncAutomaticallyAsUser(int userId) {
enforceCrossUserPermission(userId,
"no permission to read the sync settings for user " + userId);
mContext.enforceCallingOrSelfPermission(Manifest.permission.READ_SYNC_SETTINGS,
"no permission to read the sync settings");
long identityToken = clearCallingIdentity();
try {
SyncManager syncManager = getSyncManager();
if (syncManager != null) {
return syncManager.getSyncStorageEngine().getMasterSyncAutomatically(userId);
}
} finally {
restoreCallingIdentity(identityToken);
}
return false;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMasterSyncAutomaticallyAsUser
File: services/core/java/com/android/server/content/ContentService.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-2426 | MEDIUM | 4.3 | android | getMasterSyncAutomaticallyAsUser | services/core/java/com/android/server/content/ContentService.java | 63363af721650e426db5b0bdfb8b2d4fe36abdb0 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public String getType(Uri arg0) {
return "application/vnd.hgz.vocabletrainer";
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getType
File: src/at/hgz/vocabletrainer/VocableTrainerProvider.java
Repository: hgzojer/vocabletrainer
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2017-20181 | MEDIUM | 4.3 | hgzojer/vocabletrainer | getType | src/at/hgz/vocabletrainer/VocableTrainerProvider.java | accf6838078f8eb105cfc7865aba5c705fb68426 | 0 |
Analyze the following code function for security vulnerabilities | public static void copyToDir(Directory in, Directory out, String inFile, String outFile)
throws DirectoryException {
try {
if (in.containsDir(inFile)) {
in.getDir(inFile).copyToDir(out.createDir(outFile));
} else {
BrutIO.copyAndClose(in.getFileInput(inFile), out.getFileOutput(outFile));
}
} catch (IOException ex) {
throw new DirectoryException("Error copying file: " + inFile, ex);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: copyToDir
File: brut.j.dir/src/main/java/brut/directory/DirUtil.java
Repository: iBotPeaches/Apktool
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2024-21633 | HIGH | 7.8 | iBotPeaches/Apktool | copyToDir | brut.j.dir/src/main/java/brut/directory/DirUtil.java | d348c43b24a9de350ff6e5bd610545a10c1fc712 | 0 |
Analyze the following code function for security vulnerabilities | private void dismissVolumeDialog() {
if (mVolumeComponent != null) {
mVolumeComponent.dismissNow();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: dismissVolumeDialog
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2017-0822 | HIGH | 7.5 | android | dismissVolumeDialog | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | private Element elementAsLink(String url, String text) {
Element link = new Element(Tag.A).attr("href", url).text(text);
return new Element(Tag.LI).appendChild(link);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: elementAsLink
File: flow-server/src/main/java/com/vaadin/flow/router/RouteNotFoundError.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2021-31412 | MEDIUM | 4.3 | vaadin/flow | elementAsLink | flow-server/src/main/java/com/vaadin/flow/router/RouteNotFoundError.java | c79a7a8dbe1a494ff99a591d2e85b1100fc0aa15 | 0 |
Analyze the following code function for security vulnerabilities | boolean checkDestination(SmsTracker tracker) {
if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION)
== PackageManager.PERMISSION_GRANTED) {
return true; // app is pre-approved to send to short codes
} else {
int rule = mPremiumSmsRule.get();
int smsCategory = SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
if (rule == PREMIUM_RULE_USE_SIM || rule == PREMIUM_RULE_USE_BOTH) {
String simCountryIso = mTelephonyManager.getSimCountryIso();
if (simCountryIso == null || simCountryIso.length() != 2) {
Rlog.e(TAG, "Can't get SIM country Iso: trying network country Iso");
simCountryIso = mTelephonyManager.getNetworkCountryIso();
}
smsCategory = mUsageMonitor.checkDestination(tracker.mDestAddress, simCountryIso);
}
if (rule == PREMIUM_RULE_USE_NETWORK || rule == PREMIUM_RULE_USE_BOTH) {
String networkCountryIso = mTelephonyManager.getNetworkCountryIso();
if (networkCountryIso == null || networkCountryIso.length() != 2) {
Rlog.e(TAG, "Can't get Network country Iso: trying SIM country Iso");
networkCountryIso = mTelephonyManager.getSimCountryIso();
}
smsCategory = SmsUsageMonitor.mergeShortCodeCategories(smsCategory,
mUsageMonitor.checkDestination(tracker.mDestAddress, networkCountryIso));
}
if (smsCategory == SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE
|| smsCategory == SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE
|| smsCategory == SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE) {
return true; // not a premium short code
}
// Wait for user confirmation unless the user has set permission to always allow/deny
int premiumSmsPermission = mUsageMonitor.getPremiumSmsPermission(
tracker.mAppInfo.packageName);
if (premiumSmsPermission == SmsUsageMonitor.PREMIUM_SMS_PERMISSION_UNKNOWN) {
// First time trying to send to premium SMS.
premiumSmsPermission = SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ASK_USER;
}
switch (premiumSmsPermission) {
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ALWAYS_ALLOW:
Rlog.d(TAG, "User approved this app to send to premium SMS");
return true;
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_NEVER_ALLOW:
Rlog.w(TAG, "User denied this app from sending to premium SMS");
sendMessage(obtainMessage(EVENT_STOP_SENDING, tracker));
return false; // reject this message
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ASK_USER:
default:
int event;
if (smsCategory == SmsUsageMonitor.CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE) {
event = EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE;
} else {
event = EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE;
}
sendMessage(obtainMessage(event, tracker));
return false; // wait for user confirmation
}
}
} | Vulnerability Classification:
- CWE: CWE-264
- CVE: CVE-2016-3888
- Severity: LOW
- CVSS Score: 2.1
Description: Do not allow premium SMS during SuW
Bug: 29420123
Change-Id: I41ef7138635f11fbe7f495dd81103458cb969c35
(cherry picked from commit 15f55ca2f204e664807e047b5f898693b274bab6)
Function: checkDestination
File: src/java/com/android/internal/telephony/SMSDispatcher.java
Repository: android
Fixed Code:
boolean checkDestination(SmsTracker tracker) {
if (mContext.checkCallingOrSelfPermission(SEND_SMS_NO_CONFIRMATION)
== PackageManager.PERMISSION_GRANTED) {
return true; // app is pre-approved to send to short codes
} else {
int rule = mPremiumSmsRule.get();
int smsCategory = SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE;
if (rule == PREMIUM_RULE_USE_SIM || rule == PREMIUM_RULE_USE_BOTH) {
String simCountryIso = mTelephonyManager.getSimCountryIso();
if (simCountryIso == null || simCountryIso.length() != 2) {
Rlog.e(TAG, "Can't get SIM country Iso: trying network country Iso");
simCountryIso = mTelephonyManager.getNetworkCountryIso();
}
smsCategory = mUsageMonitor.checkDestination(tracker.mDestAddress, simCountryIso);
}
if (rule == PREMIUM_RULE_USE_NETWORK || rule == PREMIUM_RULE_USE_BOTH) {
String networkCountryIso = mTelephonyManager.getNetworkCountryIso();
if (networkCountryIso == null || networkCountryIso.length() != 2) {
Rlog.e(TAG, "Can't get Network country Iso: trying SIM country Iso");
networkCountryIso = mTelephonyManager.getSimCountryIso();
}
smsCategory = SmsUsageMonitor.mergeShortCodeCategories(smsCategory,
mUsageMonitor.checkDestination(tracker.mDestAddress, networkCountryIso));
}
if (smsCategory == SmsUsageMonitor.CATEGORY_NOT_SHORT_CODE
|| smsCategory == SmsUsageMonitor.CATEGORY_FREE_SHORT_CODE
|| smsCategory == SmsUsageMonitor.CATEGORY_STANDARD_SHORT_CODE) {
return true; // not a premium short code
}
// Do not allow any premium sms during SuW
if (Settings.Global.getInt(mResolver, Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
Rlog.e(TAG, "Can't send premium sms during Setup Wizard");
return false;
}
// Wait for user confirmation unless the user has set permission to always allow/deny
int premiumSmsPermission = mUsageMonitor.getPremiumSmsPermission(
tracker.mAppInfo.packageName);
if (premiumSmsPermission == SmsUsageMonitor.PREMIUM_SMS_PERMISSION_UNKNOWN) {
// First time trying to send to premium SMS.
premiumSmsPermission = SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ASK_USER;
}
switch (premiumSmsPermission) {
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ALWAYS_ALLOW:
Rlog.d(TAG, "User approved this app to send to premium SMS");
return true;
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_NEVER_ALLOW:
Rlog.w(TAG, "User denied this app from sending to premium SMS");
sendMessage(obtainMessage(EVENT_STOP_SENDING, tracker));
return false; // reject this message
case SmsUsageMonitor.PREMIUM_SMS_PERMISSION_ASK_USER:
default:
int event;
if (smsCategory == SmsUsageMonitor.CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE) {
event = EVENT_CONFIRM_SEND_TO_POSSIBLE_PREMIUM_SHORT_CODE;
} else {
event = EVENT_CONFIRM_SEND_TO_PREMIUM_SHORT_CODE;
}
sendMessage(obtainMessage(event, tracker));
return false; // wait for user confirmation
}
}
} | [
"CWE-264"
] | CVE-2016-3888 | LOW | 2.1 | android | checkDestination | src/java/com/android/internal/telephony/SMSDispatcher.java | b8d1aee993dcc565e6576b2f2439a8f5a507cff6 | 1 |
Analyze the following code function for security vulnerabilities | public GestureRecorder getGestureRecorder() {
return mGestureRec;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getGestureRecorder
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2017-0822 | HIGH | 7.5 | android | getGestureRecorder | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | private static void loadLibraryByHelper(final Class<?> helper, final String name, final boolean absolute)
throws UnsatisfiedLinkError {
Object ret = AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
// Invoke the helper to load the native library, if succeed, then the native
// library belong to the specified ClassLoader.
Method method = helper.getMethod("loadLibrary", String.class, boolean.class);
method.setAccessible(true);
return method.invoke(null, name, absolute);
} catch (Exception e) {
return e;
}
}
});
if (ret instanceof Throwable) {
Throwable t = (Throwable) ret;
assert !(t instanceof UnsatisfiedLinkError) : t + " should be a wrapper throwable";
Throwable cause = t.getCause();
if (cause instanceof UnsatisfiedLinkError) {
throw (UnsatisfiedLinkError) cause;
}
UnsatisfiedLinkError ule = new UnsatisfiedLinkError(t.getMessage());
ule.initCause(t);
throw ule;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: loadLibraryByHelper
File: common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java
Repository: netty
The code follows secure coding practices. | [
"CWE-378",
"CWE-379"
] | CVE-2021-21290 | LOW | 1.9 | netty | loadLibraryByHelper | common/src/main/java/io/netty/util/internal/NativeLibraryLoader.java | c735357bf29d07856ad171c6611a2e1a0e0000ec | 0 |
Analyze the following code function for security vulnerabilities | public int delete(String table, String whereClause, String[] whereArgs) {
acquireReference();
try {
SQLiteStatement statement = new SQLiteStatement(this, "DELETE FROM " + table +
(!TextUtils.isEmpty(whereClause) ? " WHERE " + whereClause : ""), whereArgs);
try {
return statement.executeUpdateDelete();
} finally {
statement.close();
}
} finally {
releaseReference();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: delete
File: core/java/android/database/sqlite/SQLiteDatabase.java
Repository: android
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2018-9493 | LOW | 2.1 | android | delete | core/java/android/database/sqlite/SQLiteDatabase.java | ebc250d16c747f4161167b5ff58b3aea88b37acf | 0 |
Analyze the following code function for security vulnerabilities | public String dialogContentStart(String title) {
return dialogContent(HTML_START, title);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: dialogContentStart
File: src/org/opencms/workplace/CmsDialog.java
Repository: alkacon/opencms-core
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2013-4600 | MEDIUM | 4.3 | alkacon/opencms-core | dialogContentStart | src/org/opencms/workplace/CmsDialog.java | 72a05e3ea1cf692e2efce002687272e63f98c14a | 0 |
Analyze the following code function for security vulnerabilities | private void gc(ConsoleOutputStreamConsumer outputStreamConsumer) {
log(outputStreamConsumer, "Performing git gc");
CommandLine gitGc = gitWd().withArgs("gc", "--auto");
run(gitGc, outputStreamConsumer);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: gc
File: domain/src/main/java/com/thoughtworks/go/domain/materials/git/GitCommand.java
Repository: gocd
The code follows secure coding practices. | [
"CWE-77"
] | CVE-2021-43286 | MEDIUM | 6.5 | gocd | gc | domain/src/main/java/com/thoughtworks/go/domain/materials/git/GitCommand.java | 6fa9fb7a7c91e760f1adc2593acdd50f2d78676b | 0 |
Analyze the following code function for security vulnerabilities | private void handleIpConfigurationLost() {
mWifiInfo.setInetAddress(null);
mWifiInfo.setMeteredHint(false);
mWifiConfigManager.updateNetworkSelectionStatus(mLastNetworkId,
WifiConfiguration.NetworkSelectionStatus.DISABLED_DHCP_FAILURE);
/* DHCP times out after about 30 seconds, we do a
* disconnect thru supplicant, we will let autojoin retry connecting to the network
*/
mWifiNative.disconnect(mInterfaceName);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: handleIpConfigurationLost
File: service/java/com/android/server/wifi/ClientModeImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21242 | CRITICAL | 9.8 | android | handleIpConfigurationLost | service/java/com/android/server/wifi/ClientModeImpl.java | 72e903f258b5040b8f492cf18edd124b5a1ac770 | 0 |
Analyze the following code function for security vulnerabilities | private void purgeOldGrants(UserAccounts accounts) {
synchronized (accounts.dbLock) {
synchronized (accounts.cacheLock) {
List<Integer> uids = accounts.accountsDb.findAllUidGrants();
for (int uid : uids) {
final boolean packageExists = mPackageManager.getPackagesForUid(uid) != null;
if (packageExists) {
continue;
}
Log.d(TAG, "deleting grants for UID " + uid
+ " because its package is no longer installed");
accounts.accountsDb.deleteGrantsByUid(uid);
}
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: purgeOldGrants
File: services/core/java/com/android/server/accounts/AccountManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other",
"CWE-502"
] | CVE-2023-45777 | HIGH | 7.8 | android | purgeOldGrants | services/core/java/com/android/server/accounts/AccountManagerService.java | f810d81839af38ee121c446105ca67cb12992fc6 | 0 |
Analyze the following code function for security vulnerabilities | public java.net.URL getURL(String columnName) throws SQLException {
return getURL(findColumn(columnName));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getURL
File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
Repository: pgjdbc
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2022-31197 | HIGH | 8 | pgjdbc | getURL | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | 739e599d52ad80f8dcd6efedc6157859b1a9d637 | 0 |
Analyze the following code function for security vulnerabilities | @OnClose
public void onClose(){
for(String activityId : activitiesMap.keySet()){
activitiesMap.get(activityId).onClose();
}
activitiesMap.clear();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onClose
File: jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskdetailsmulti/TaskDetailsMultiPresenter.java
Repository: kiegroup/jbpm-wb
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2013-6465 | LOW | 3.5 | kiegroup/jbpm-wb | onClose | jbpm-console-ng-human-tasks/jbpm-console-ng-human-tasks-client/src/main/java/org/jbpm/console/ng/ht/client/editors/taskdetailsmulti/TaskDetailsMultiPresenter.java | 4818204506e8e94645b52adb9426bedfa9ffdd04 | 0 |
Analyze the following code function for security vulnerabilities | public static void registerCodeActionParticipants(Map<String, ICodeActionParticipant> codeActions) {
codeActions.put(ElementUnterminated.getCode(), new ElementUnterminatedCodeAction());
codeActions.put(EqRequiredInAttribute.getCode(), new EqRequiredInAttributeCodeAction());
codeActions.put(OpenQuoteExpected.getCode(), new OpenQuoteExpectedCodeAction());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: registerCodeActionParticipants
File: org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/XMLSyntaxErrorCode.java
Repository: eclipse/lemminx
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2019-18213 | MEDIUM | 6.5 | eclipse/lemminx | registerCodeActionParticipants | org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/XMLSyntaxErrorCode.java | c8bf3245a72cace50ee2aae5eee69538c58ce056 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public int getClipHeight(Object graphics) {
return ((AndroidGraphics) graphics).getClipHeight();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getClipHeight
File: Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
Repository: codenameone/CodenameOne
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2022-4903 | MEDIUM | 5.1 | codenameone/CodenameOne | getClipHeight | Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java | dad49c9ef26a598619fc48d2697151a02987d478 | 0 |
Analyze the following code function for security vulnerabilities | @CalledByNative
private void addPermissionSection(String name, int type, int currentSetting) {
// We have at least one permission, so show the lower permissions area.
setVisibilityOfLowerDialogArea(true);
View permissionRow = LayoutInflater.from(mContext).inflate(
R.layout.website_settings_permission_row, null);
ImageView permission_icon = (ImageView) permissionRow.findViewById(
R.id.website_settings_permission_icon);
permission_icon.setImageResource(getImageResourceForPermission(type));
TextView permission_name = (TextView) permissionRow.findViewById(
R.id.website_settings_permission_name);
permission_name.setText(name);
Spinner permission_spinner = (Spinner) permissionRow.findViewById(
R.id.website_settings_permission_spinner);
// Work out the index of the currently selected setting.
int selectedSettingIndex = -1;
switch (currentSetting) {
case ContentSetting.ALLOW:
selectedSettingIndex = 0;
break;
case ContentSetting.BLOCK:
selectedSettingIndex = 1;
break;
default:
assert false : "Invalid setting " + currentSetting + " for permission " + type;
}
List<PageInfoPermissionEntry> settingsChoices = Arrays.asList(
new PageInfoPermissionEntry(mContext.getResources().getString(
R.string.page_info_permission_allow), type, ContentSetting.ALLOW),
new PageInfoPermissionEntry(mContext.getResources().getString(
R.string.page_info_permission_block), type, ContentSetting.BLOCK));
ArrayAdapter<PageInfoPermissionEntry> adapter = new ArrayAdapter<PageInfoPermissionEntry>(
mContext, R.drawable.website_settings_permission_spinner_item, settingsChoices);
adapter.setDropDownViewResource(
R.drawable.website_settings_permission_spinner_dropdown_item);
permission_spinner.setAdapter(adapter);
permission_spinner.setSelection(selectedSettingIndex, false);
permission_spinner.setOnItemSelectedListener(this);
mPermissionsList.addView(permissionRow);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: addPermissionSection
File: chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2015-1261 | MEDIUM | 5 | chromium | addPermissionSection | chrome/android/java/src/org/chromium/chrome/browser/WebsiteSettingsPopup.java | 5bf8a2dccf4777c5f065d918d1d9a2bbaa013f9f | 0 |
Analyze the following code function for security vulnerabilities | public @NonNull List<UserHandle> getBindDeviceAdminTargetUsers(@NonNull ComponentName admin) {
throwIfParentInstance("getBindDeviceAdminTargetUsers");
try {
return mService.getBindDeviceAdminTargetUsers(admin);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getBindDeviceAdminTargetUsers
File: core/java/android/app/admin/DevicePolicyManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-40089 | HIGH | 7.8 | android | getBindDeviceAdminTargetUsers | core/java/android/app/admin/DevicePolicyManager.java | e2e05f488da6abc765a62e7faf10cb74e729732e | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void run() {
android.os.Debug.stopMethodTracing();
Log.d(TAG, "stopTracing");
vibrate();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: run
File: packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2017-0822 | HIGH | 7.5 | android | run | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java | c574568aaede7f652432deb7707f20ae54bbdf9a | 0 |
Analyze the following code function for security vulnerabilities | public void setCurrentInstances(VaadinRequest request,
VaadinResponse response) {
setCurrent(this);
CurrentInstance.set(VaadinRequest.class, request);
CurrentInstance.set(VaadinResponse.class, response);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setCurrentInstances
File: flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java
Repository: vaadin/flow
The code follows secure coding practices. | [
"CWE-203"
] | CVE-2021-31404 | LOW | 1.9 | vaadin/flow | setCurrentInstances | flow-server/src/main/java/com/vaadin/flow/server/VaadinService.java | 621ef1b322737d963bee624b2d2e38cd739903d9 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void updateApplicationTemplate(String oldTemplateName, SpTemplate spTemplate, String tenantDomain)
throws IdentityApplicationManagementException {
try {
validateSPTemplateExists(oldTemplateName, spTemplate, tenantDomain);
ServiceProvider serviceProvider = unmarshalSPTemplate(spTemplate.getContent());
validateUnsupportedTemplateConfigs(serviceProvider);
applicationValidatorManager.validateSPConfigurations(serviceProvider, tenantDomain,
CarbonContext.getThreadLocalCarbonContext().getUsername());
Collection<ApplicationMgtListener> listeners =
getApplicationMgtListeners();
for (ApplicationMgtListener listener : listeners) {
if (listener.isEnable()) {
listener.doPreUpdateApplicationTemplate(serviceProvider, tenantDomain);
}
}
doUpdateApplicationTemplate(oldTemplateName, spTemplate, tenantDomain);
} catch (IdentityApplicationManagementValidationException e) {
log.error("Validation error when updating the application template: " + oldTemplateName + " in:" +
tenantDomain);
logValidationErrorMessages(e);
throw new IdentityApplicationManagementClientException(e.getValidationMsg());
} catch (IdentityApplicationManagementException e) {
String errorMsg = String.format("Error in updating the application template: %s in tenant: %s",
oldTemplateName, tenantDomain);
throw new IdentityApplicationManagementException(errorMsg, e);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: updateApplicationTemplate
File: components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationManagementServiceImpl.java
Repository: wso2/carbon-identity-framework
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2021-42646 | MEDIUM | 6.4 | wso2/carbon-identity-framework | updateApplicationTemplate | components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/ApplicationManagementServiceImpl.java | e9119883ee02a884f3c76c7bbc4022a4f4c58fc0 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean isLookupFontSupported() {
return true;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isLookupFontSupported
File: Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java
Repository: codenameone/CodenameOne
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2022-4903 | MEDIUM | 5.1 | codenameone/CodenameOne | isLookupFontSupported | Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java | dad49c9ef26a598619fc48d2697151a02987d478 | 0 |
Analyze the following code function for security vulnerabilities | private int applyUserId(int uid, int userId) {
return UserHandle.getUid(userId, uid);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: applyUserId
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-3833 | MEDIUM | 4.3 | android | applyUserId | services/core/java/com/android/server/am/ActivityManagerService.java | aaa0fee0d7a8da347a0c47cef5249c70efee209e | 0 |
Analyze the following code function for security vulnerabilities | public Integer getMaximumTransactionBundleSize() {
return myMaximumTransactionBundleSize;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getMaximumTransactionBundleSize
File: hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java
Repository: hapifhir/hapi-fhir
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2021-32053 | MEDIUM | 5 | hapifhir/hapi-fhir | getMaximumTransactionBundleSize | hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java | f2934b229c491235ab0e7782dea86b324521082a | 0 |
Analyze the following code function for security vulnerabilities | protected String htmlImg2MsImg(String input) {
// <img src="xxx/resource/md/get/a0b19136_中心主题.png"/> -> 
String regex = "(<img\\s*src=\\\"(.*?)\\\".*?>)";
Pattern pattern = Pattern.compile(regex);
if (StringUtils.isBlank(input)) {
return "";
}
Matcher matcher = pattern.matcher(input);
String result = input;
while (matcher.find()) {
String url = matcher.group(2);
if (url.contains("/resource/md/get/")) { // 兼容旧数据
String path = url.substring(url.indexOf("/resource/md/get/"));
String name = path.substring(path.indexOf("/resource/md/get/") + 26);
String mdLink = "";
result = matcher.replaceFirst(mdLink);
matcher = pattern.matcher(result);
} else if(url.contains("/resource/md/get")) { //新数据走这里
String path = url.substring(url.indexOf("/resource/md/get"));
String name = path.substring(path.indexOf("/resource/md/get") + 35);
String mdLink = "";
result = matcher.replaceFirst(mdLink);
matcher = pattern.matcher(result);
}
}
return result;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: htmlImg2MsImg
File: test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java
Repository: metersphere
The code follows secure coding practices. | [
"CWE-918"
] | CVE-2022-23544 | MEDIUM | 6.1 | metersphere | htmlImg2MsImg | test-track/backend/src/main/java/io/metersphere/service/issue/platform/AbstractIssuePlatform.java | d0f95b50737c941b29d507a4cc3545f2dc6ab121 | 0 |
Analyze the following code function for security vulnerabilities | private void beginTransaction(SQLiteTransactionListener transactionListener,
boolean exclusive) {
acquireReference();
try {
getThreadSession().beginTransaction(
exclusive ? SQLiteSession.TRANSACTION_MODE_EXCLUSIVE :
SQLiteSession.TRANSACTION_MODE_IMMEDIATE,
transactionListener,
getThreadDefaultConnectionFlags(false /*readOnly*/), null);
} finally {
releaseReference();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: beginTransaction
File: core/java/android/database/sqlite/SQLiteDatabase.java
Repository: android
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2018-9493 | LOW | 2.1 | android | beginTransaction | core/java/android/database/sqlite/SQLiteDatabase.java | ebc250d16c747f4161167b5ff58b3aea88b37acf | 0 |
Analyze the following code function for security vulnerabilities | @Override
public String[] getAlias() {
return new String[]{"twitchnotifier", "streamnotifier"};
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getAlias
File: src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java
Repository: Ree6-Applications/Ree6
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2022-39302 | MEDIUM | 5.4 | Ree6-Applications/Ree6 | getAlias | src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java | 459b5bc24f0ea27e50031f563373926e94b9aa0a | 0 |
Analyze the following code function for security vulnerabilities | private void pushNativePageStateToNavigationEntry() {
assert mNativeTabAndroid != 0 && getNativePage() != null;
nativeSetActiveNavigationEntryTitleForUrl(mNativeTabAndroid, getNativePage().getUrl(),
getNativePage().getTitle());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: pushNativePageStateToNavigationEntry
File: chrome/android/java/src/org/chromium/chrome/browser/Tab.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | pushNativePageStateToNavigationEntry | chrome/android/java/src/org/chromium/chrome/browser/Tab.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private static String genRandomStr() {
String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 16; i++) {
int number = random.nextInt(base.length());
sb.append(base.charAt(number));
}
return sb.toString();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: genRandomStr
File: weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java
Repository: Wechat-Group/WxJava
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-20318 | HIGH | 7.5 | Wechat-Group/WxJava | genRandomStr | weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java | 6272639f02e397fed40828a2d0da66c30264bc0e | 0 |
Analyze the following code function for security vulnerabilities | private void setSelectedRcoiForPasspoint(WifiConfiguration config) {
// Only relevant for Passpoint providers with roaming consortium subscriptions
if (config.isPasspoint() && config.roamingConsortiumIds != null
&& config.roamingConsortiumIds.length > 0) {
long selectedRcoi = mPasspointManager.getSelectedRcoiForNetwork(
config.getPasspointUniqueId(), config.SSID);
if (selectedRcoi != 0) {
config.enterpriseConfig.setSelectedRcoi(selectedRcoi);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setSelectedRcoiForPasspoint
File: service/java/com/android/server/wifi/ClientModeImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21242 | CRITICAL | 9.8 | android | setSelectedRcoiForPasspoint | service/java/com/android/server/wifi/ClientModeImpl.java | 72e903f258b5040b8f492cf18edd124b5a1ac770 | 0 |
Analyze the following code function for security vulnerabilities | void finishLaunchTickingLocked() {
launchTickTime = 0;
final Task rootTask = getRootTask();
if (rootTask == null) {
return;
}
rootTask.removeLaunchTickMessages();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: finishLaunchTickingLocked
File: services/core/java/com/android/server/wm/ActivityRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21145 | HIGH | 7.8 | android | finishLaunchTickingLocked | services/core/java/com/android/server/wm/ActivityRecord.java | 44aeef1b82ecf21187d4903c9e3666a118bdeaf3 | 0 |
Analyze the following code function for security vulnerabilities | public String loadXML(String fileName) {
loadFile(fileName);
return getXML();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: loadXML
File: HTML_Renderer/src/main/java/org/loboevolution/html/js/xml/XMLDocument.java
Repository: LoboEvolution
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-1000540 | MEDIUM | 6.8 | LoboEvolution | loadXML | HTML_Renderer/src/main/java/org/loboevolution/html/js/xml/XMLDocument.java | 9b75694cedfa4825d4a2330abf2719d470c654cd | 0 |
Analyze the following code function for security vulnerabilities | @Beta
public static BufferedReader newReader(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: newReader
File: guava/src/com/google/common/io/Files.java
Repository: google/guava
The code follows secure coding practices. | [
"CWE-732"
] | CVE-2020-8908 | LOW | 2.1 | google/guava | newReader | guava/src/com/google/common/io/Files.java | fec0dbc4634006a6162cfd4d0d09c962073ddf40 | 0 |
Analyze the following code function for security vulnerabilities | private void placeWindowBefore(WindowState pos, WindowState window) {
final WindowList windows = pos.getWindowList();
int i = windows.indexOf(pos);
if (DEBUG_FOCUS || DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(
TAG, "Adding window " + window + " at "
+ i + " of " + windows.size() + " (before " + pos + ")");
if (i < 0) {
Slog.w(TAG, "placeWindowBefore: Unable to find " + pos + " in " + windows);
i = 0;
}
windows.add(i, window);
mWindowsChanged = true;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: placeWindowBefore
File: services/core/java/com/android/server/wm/WindowManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3875 | HIGH | 7.2 | android | placeWindowBefore | services/core/java/com/android/server/wm/WindowManagerService.java | 69729fa8b13cadbf3173fe1f389fe4f3b7bd0f9c | 0 |
Analyze the following code function for security vulnerabilities | @Override
public PlaybackState getPlaybackState() {
return getStateWithUpdatedPosition();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getPlaybackState
File: services/core/java/com/android/server/media/MediaSessionRecord.java
Repository: android
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-21280 | MEDIUM | 5.5 | android | getPlaybackState | services/core/java/com/android/server/media/MediaSessionRecord.java | 06e772e05514af4aa427641784c5eec39a892ed3 | 0 |
Analyze the following code function for security vulnerabilities | @Nonnull
public static Image renderWithTransparency(final float opacity, @Nonnull final AbstractElement element, @Nonnull final MindMapPanelConfig config, @Nonnull final RenderQuality quality) {
final AbstractElement cloned = element.makeCopy();
final Rectangle2D bounds = cloned.getBounds();
final float increase = config.safeScaleFloatValue(config.getElementBorderWidth() + config.getShadowOffset(), 0.0f);
final int imageWidth = (int) Math.round(bounds.getWidth() + increase);
final int imageHeight = (int) Math.round(bounds.getHeight() + increase);
bounds.setRect(0.0d, 0.0d, bounds.getWidth(), bounds.getHeight());
final BufferedImage result = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_ARGB);
for (int y = 0; y < imageHeight; y++) {
for (int x = 0; x < imageWidth; x++) {
result.setRGB(x, y, 0);
}
}
final Graphics2D g = result.createGraphics();
final MMGraphics gfx = new MMGraphics2DWrapper(g);
try {
quality.prepare(g);
cloned.doPaint(gfx, config, false);
} finally {
gfx.dispose();
}
int alpha;
if (opacity <= 0.0f) {
alpha = 0x00;
} else if (opacity >= 1.0f) {
alpha = 0xFF;
} else {
alpha = Math.round(0xFF * opacity);
}
alpha <<= 24;
for (int y = 0; y < imageHeight; y++) {
for (int x = 0; x < imageWidth; x++) {
final int curAlpha = result.getRGB(x, y) >>> 24;
if (curAlpha == 0xFF) {
result.setRGB(x, y, (result.getRGB(x, y) & 0xFFFFFF) | alpha);
} else if (curAlpha != 0x00) {
final int calculated = Math.round(curAlpha * opacity) << 24;
result.setRGB(x, y, (result.getRGB(x, y) & 0xFFFFFF) | calculated);
}
}
}
return result;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: renderWithTransparency
File: mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java
Repository: raydac/netbeans-mmd-plugin
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2018-1000542 | MEDIUM | 6.8 | raydac/netbeans-mmd-plugin | renderWithTransparency | mind-map/mind-map-swing-panel/src/main/java/com/igormaznitsa/mindmap/swing/panel/utils/Utils.java | 9fba652bf06e649186b8f9e612d60e9cc15097e9 | 0 |
Analyze the following code function for security vulnerabilities | public void update(Status status) {
ClickHouseNodeManager m = this.manager.get();
if (m != null) {
m.update(this, status);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: update
File: clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java
Repository: ClickHouse/clickhouse-java
The code follows secure coding practices. | [
"CWE-209"
] | CVE-2024-23689 | HIGH | 8.8 | ClickHouse/clickhouse-java | update | clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java | 4f8d9303eb991b39ec7e7e34825241efa082238a | 0 |
Analyze the following code function for security vulnerabilities | protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
String text;
switch (p.currentTokenId()) {
case JsonTokenId.ID_STRING:
text = p.getText();
break;
case JsonTokenId.ID_NUMBER_FLOAT:
CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Byte.TYPE);
if (act == CoercionAction.AsNull) {
return (byte) 0;
}
if (act == CoercionAction.AsEmpty) {
return (byte) 0;
}
return p.getByteValue();
case JsonTokenId.ID_NUMBER_INT:
return p.getByteValue();
case JsonTokenId.ID_NULL:
_verifyNullForPrimitive(ctxt);
return (byte) 0;
// 29-Jun-2020, tatu: New! "Scalar from Object" (mostly for XML)
case JsonTokenId.ID_START_OBJECT:
text = ctxt.extractScalarFromObject(p, this, Byte.TYPE);
break;
case JsonTokenId.ID_START_ARRAY: // unwrapping / from-empty-array coercion?
// 12-Jun-2020, tatu: For some reason calling `_deserializeFromArray()` won't work so:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final byte parsed = _parseBytePrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
// fall through
default:
return ((Byte) ctxt.handleUnexpectedToken(ctxt.constructType(Byte.TYPE), p)).byteValue();
}
// Coercion from String
CoercionAction act = _checkFromStringCoercion(ctxt, text,
LogicalType.Integer, Byte.TYPE);
if (act == CoercionAction.AsNull) {
// 03-May-2021, tatu: Might not be allowed (should we do "empty" check?)
_verifyNullForPrimitive(ctxt);
return (byte) 0;
}
if (act == CoercionAction.AsEmpty) {
return (byte) 0;
}
text = text.trim();
if (_hasTextualNull(text)) {
_verifyNullForPrimitiveCoercion(ctxt, text);
return (byte) 0;
}
int value;
try {
value = NumberInput.parseInt(text);
} catch (IllegalArgumentException iae) {
return (Byte) ctxt.handleWeirdStringValue(_valueClass, text,
"not a valid `byte` value");
}
// So far so good: but does it fit? Allow both -128 / 255 range (inclusive)
if (_byteOverflow(value)) {
return (Byte) ctxt.handleWeirdStringValue(_valueClass, text,
"overflow, value cannot be represented as 8-bit value");
}
return (byte) value;
} | Vulnerability Classification:
- CWE: CWE-502
- CVE: CVE-2022-42003
- Severity: HIGH
- CVSS Score: 7.5
Description: Fix #3590
Function: _parseBytePrimitive
File: src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java
Repository: FasterXML/jackson-databind
Fixed Code:
protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
String text;
switch (p.currentTokenId()) {
case JsonTokenId.ID_STRING:
text = p.getText();
break;
case JsonTokenId.ID_NUMBER_FLOAT:
CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Byte.TYPE);
if (act == CoercionAction.AsNull) {
return (byte) 0;
}
if (act == CoercionAction.AsEmpty) {
return (byte) 0;
}
return p.getByteValue();
case JsonTokenId.ID_NUMBER_INT:
return p.getByteValue();
case JsonTokenId.ID_NULL:
_verifyNullForPrimitive(ctxt);
return (byte) 0;
// 29-Jun-2020, tatu: New! "Scalar from Object" (mostly for XML)
case JsonTokenId.ID_START_OBJECT:
text = ctxt.extractScalarFromObject(p, this, Byte.TYPE);
break;
case JsonTokenId.ID_START_ARRAY: // unwrapping / from-empty-array coercion?
// 12-Jun-2020, tatu: For some reason calling `_deserializeFromArray()` won't work so:
if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
if (p.nextToken() == JsonToken.START_ARRAY) {
return (byte) handleNestedArrayForSingle(p, ctxt);
}
final byte parsed = _parseBytePrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
// fall through
default:
return ((Byte) ctxt.handleUnexpectedToken(ctxt.constructType(Byte.TYPE), p)).byteValue();
}
// Coercion from String
CoercionAction act = _checkFromStringCoercion(ctxt, text,
LogicalType.Integer, Byte.TYPE);
if (act == CoercionAction.AsNull) {
// 03-May-2021, tatu: Might not be allowed (should we do "empty" check?)
_verifyNullForPrimitive(ctxt);
return (byte) 0;
}
if (act == CoercionAction.AsEmpty) {
return (byte) 0;
}
text = text.trim();
if (_hasTextualNull(text)) {
_verifyNullForPrimitiveCoercion(ctxt, text);
return (byte) 0;
}
int value;
try {
value = NumberInput.parseInt(text);
} catch (IllegalArgumentException iae) {
return (Byte) ctxt.handleWeirdStringValue(_valueClass, text,
"not a valid `byte` value");
}
// So far so good: but does it fit? Allow both -128 / 255 range (inclusive)
if (_byteOverflow(value)) {
return (Byte) ctxt.handleWeirdStringValue(_valueClass, text,
"overflow, value cannot be represented as 8-bit value");
}
return (byte) value;
} | [
"CWE-502"
] | CVE-2022-42003 | HIGH | 7.5 | FasterXML/jackson-databind | _parseBytePrimitive | src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java | d78d00ee7b5245b93103fef3187f70543d67ca33 | 1 |
Analyze the following code function for security vulnerabilities | public boolean isVisible() {
if (hasFeature(ElementData.class)) {
boolean isVisibleSelf = getFeature(ElementData.class).isVisible();
if (!isVisibleSelf || getParent() == null) {
return isVisibleSelf;
}
return parent.isVisible();
}
return getParent() == null ? true : parent.isVisible();
} | Vulnerability Classification:
- CWE: CWE-200
- CVE: CVE-2023-25499
- Severity: MEDIUM
- CVSS Score: 6.5
Description: Cleanup, and refactoring, in Element, StateNode, UIInternals classes + mvn formatter.
Function: isVisible
File: flow-server/src/main/java/com/vaadin/flow/internal/StateNode.java
Repository: vaadin/flow
Fixed Code:
public boolean isVisible() {
if (hasFeature(ElementData.class)) {
boolean isVisibleSelf = getFeature(ElementData.class).isVisible();
if (!isVisibleSelf || getParent() == null) {
return isVisibleSelf;
}
return parent.isVisible();
}
return getParent() == null || parent.isVisible();
} | [
"CWE-200"
] | CVE-2023-25499 | MEDIUM | 6.5 | vaadin/flow | isVisible | flow-server/src/main/java/com/vaadin/flow/internal/StateNode.java | 428cc97eaa9c89b1124e39f0089bbb741b6b21cc | 1 |
Analyze the following code function for security vulnerabilities | public boolean isAccessPermissionEpub() {
synchronized (this) {
try {
if ((navigationHelper != null && !isEnabled(EPUBDownloadJob.LOCAL_TYPE, navigationHelper.getCurrentPage())) || viewManager == null
|| !DownloadJob.ocrFolderExists(viewManager.getPi())) {
return false;
}
} catch (PresentationException | IndexUnreachableException e) {
logger.error("Error checking EPUB resources: {}", e.getMessage());
return false;
}
// TODO EPUB privilege type
return viewManager.isAccessPermissionPdf();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isAccessPermissionEpub
File: goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java
Repository: intranda/goobi-viewer-core
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2023-29014 | MEDIUM | 6.1 | intranda/goobi-viewer-core | isAccessPermissionEpub | goobi-viewer-core/src/main/java/io/goobi/viewer/managedbeans/ActiveDocumentBean.java | c29efe60e745a94d03debc17681c4950f3917455 | 0 |
Analyze the following code function for security vulnerabilities | public static Element getChildElement(Element element,
String childName) {
for (org.w3c.dom.Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {
if (node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE &&
((Element) node).getTagName().equals(childName)) {
return (Element) node;
}
}
return null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getChildElement
File: bundles/org.jkiss.utils/src/org/jkiss/utils/xml/XMLUtils.java
Repository: dbeaver
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2021-3836 | MEDIUM | 4.3 | dbeaver | getChildElement | bundles/org.jkiss.utils/src/org/jkiss/utils/xml/XMLUtils.java | 4debf8f25184b7283681ed3fb5e9e887d9d4fe22 | 0 |
Analyze the following code function for security vulnerabilities | public void stopRestrictingAutoJoinToSubscriptionId() {
mNonCarrierMergedNetworksStatusTracker.clear();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: stopRestrictingAutoJoinToSubscriptionId
File: service/java/com/android/server/wifi/WifiConfigManager.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21242 | CRITICAL | 9.8 | android | stopRestrictingAutoJoinToSubscriptionId | service/java/com/android/server/wifi/WifiConfigManager.java | 72e903f258b5040b8f492cf18edd124b5a1ac770 | 0 |
Analyze the following code function for security vulnerabilities | protected void executePut(String uri, InputStream content, String mediaType, int... expectedCodes) throws Exception
{
executePut(uri, content, mediaType, true, expectedCodes);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: executePut
File: xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2023-35166 | HIGH | 8.8 | xwiki/xwiki-platform | executePut | xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-ui/src/main/java/org/xwiki/test/ui/TestUtils.java | 98208c5bb1e8cdf3ff1ac35d8b3d1cb3c28b3263 | 0 |
Analyze the following code function for security vulnerabilities | private static boolean isValidIpAddress(String ipAddress) {
return isIp4Address(ipAddress) || isIp6Address(ipAddress);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isValidIpAddress
File: graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java
Repository: Graylog2/graylog2-server
The code follows secure coding practices. | [
"CWE-345"
] | CVE-2023-41045 | MEDIUM | 5.3 | Graylog2/graylog2-server | isValidIpAddress | graylog2-server/src/main/java/org/graylog2/lookup/adapters/dnslookup/DnsClient.java | 466af814523cffae9fbc7e77bab7472988f03c3e | 0 |
Analyze the following code function for security vulnerabilities | private void appendBasicMemEntry(StringBuilder sb, int oomAdj, int procState, long pss,
long memtrack, String name) {
sb.append(" ");
sb.append(ProcessList.makeOomAdjString(oomAdj));
sb.append(' ');
sb.append(ProcessList.makeProcStateString(procState));
sb.append(' ');
ProcessList.appendRamKb(sb, pss);
sb.append(" kB: ");
sb.append(name);
if (memtrack > 0) {
sb.append(" (");
sb.append(memtrack);
sb.append(" kB memtrack)");
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: appendBasicMemEntry
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-3833 | MEDIUM | 4.3 | android | appendBasicMemEntry | services/core/java/com/android/server/am/ActivityManagerService.java | aaa0fee0d7a8da347a0c47cef5249c70efee209e | 0 |
Analyze the following code function for security vulnerabilities | public boolean launchAssistIntent(Intent intent, int requestType, String hint, int userHandle,
Bundle args) {
return enqueueAssistContext(requestType, intent, hint, null, null, userHandle, args,
PENDING_ASSIST_EXTRAS_TIMEOUT) != null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: launchAssistIntent
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-200"
] | CVE-2016-2500 | MEDIUM | 4.3 | android | launchAssistIntent | services/core/java/com/android/server/am/ActivityManagerService.java | 9878bb99b77c3681f0fda116e2964bac26f349c3 | 0 |
Analyze the following code function for security vulnerabilities | @Override
boolean isSyncFinished() {
if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mViewVisibility == View.GONE
&& !isVisibleRequested()) {
// Don't wait for GONE windows. However, we don't alter the state in case the window
// becomes un-gone while the syncset is still active.
return true;
}
return super.isSyncFinished();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isSyncFinished
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-35674 | HIGH | 7.8 | android | isSyncFinished | services/core/java/com/android/server/wm/WindowState.java | 7428962d3b064ce1122809d87af65099d1129c9e | 0 |
Analyze the following code function for security vulnerabilities | @NonNull
public Builder setAuthenticationRequired(boolean authenticationRequired) {
mAuthenticationRequired = authenticationRequired;
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setAuthenticationRequired
File: core/java/android/app/Notification.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-21288 | MEDIUM | 5.5 | android | setAuthenticationRequired | core/java/android/app/Notification.java | 726247f4f53e8cc0746175265652fa415a123c0c | 0 |
Analyze the following code function for security vulnerabilities | public void refreshExtensions() throws ExtensionRefreshException {
ExtensionList<ExtensionFinder> finders = getExtensionList(ExtensionFinder.class);
for (ExtensionFinder ef : finders) {
if (!ef.isRefreshable())
throw new ExtensionRefreshException(ef+" doesn't support refresh");
}
List<ExtensionComponentSet> fragments = Lists.newArrayList();
for (ExtensionFinder ef : finders) {
fragments.add(ef.refresh());
}
ExtensionComponentSet delta = ExtensionComponentSet.union(fragments).filtered();
// if we find a new ExtensionFinder, we need it to list up all the extension points as well
List<ExtensionComponent<ExtensionFinder>> newFinders = Lists.newArrayList(delta.find(ExtensionFinder.class));
while (!newFinders.isEmpty()) {
ExtensionFinder f = newFinders.remove(newFinders.size()-1).getInstance();
ExtensionComponentSet ecs = ExtensionComponentSet.allOf(f).filtered();
newFinders.addAll(ecs.find(ExtensionFinder.class));
delta = ExtensionComponentSet.union(delta, ecs);
}
for (ExtensionList el : extensionLists.values()) {
el.refresh(delta);
}
for (ExtensionList el : descriptorLists.values()) {
el.refresh(delta);
}
// TODO: we need some generalization here so that extension points can be notified when a refresh happens?
for (ExtensionComponent<RootAction> ea : delta.find(RootAction.class)) {
Action a = ea.getInstance();
if (!actions.contains(a)) actions.add(a);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: refreshExtensions
File: core/src/main/java/jenkins/model/Jenkins.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2014-2065 | MEDIUM | 4.3 | jenkinsci/jenkins | refreshExtensions | core/src/main/java/jenkins/model/Jenkins.java | a0b00508eeb74d7033dc4100eb382df4e8fa72e7 | 0 |
Analyze the following code function for security vulnerabilities | static DownloadLaunchRunnable createForTest(DownloadStatusCallback callback,
FileDownloadModel model, FileDownloadHeader header,
IThreadPoolMonitor threadPoolMonitor,
final int minIntervalMillis,
int callbackProgressMaxCount,
boolean isForceReDownload, boolean isWifiRequired,
int maxRetryTimes) {
return new DownloadLaunchRunnable(callback, model, header, threadPoolMonitor,
minIntervalMillis, callbackProgressMaxCount, isForceReDownload, isWifiRequired,
maxRetryTimes);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: createForTest
File: library/src/main/java/com/liulishuo/filedownloader/download/DownloadLaunchRunnable.java
Repository: lingochamp/FileDownloader
The code follows secure coding practices. | [
"CWE-22"
] | CVE-2018-11248 | HIGH | 7.5 | lingochamp/FileDownloader | createForTest | library/src/main/java/com/liulishuo/filedownloader/download/DownloadLaunchRunnable.java | b023cc081bbecdd2a9f3549a3ae5c12a9647ed7f | 0 |
Analyze the following code function for security vulnerabilities | protected X509TrustManager getX509TrustManager() {
return x509TrustManager;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getX509TrustManager
File: src/main/java/org/conscrypt/SSLParametersImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3840 | HIGH | 10 | android | getX509TrustManager | src/main/java/org/conscrypt/SSLParametersImpl.java | 5af5e93463f4333187e7e35f3bd2b846654aa214 | 0 |
Analyze the following code function for security vulnerabilities | public void setYearlyVotes(Integer yearlyVotes) {
this.yearlyVotes = yearlyVotes;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setYearlyVotes
File: src/main/java/com/erudika/scoold/core/Profile.java
Repository: Erudika/scoold
The code follows secure coding practices. | [
"CWE-130"
] | CVE-2022-1543 | MEDIUM | 6.5 | Erudika/scoold | setYearlyVotes | src/main/java/com/erudika/scoold/core/Profile.java | 62a0e92e1486ddc17676a7ead2c07ff653d167ce | 0 |
Analyze the following code function for security vulnerabilities | public boolean isSelected(Object itemId) {
return selectionModel.isSelected(itemId);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isSelected
File: server/src/main/java/com/vaadin/ui/Grid.java
Repository: vaadin/framework
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2019-25028 | MEDIUM | 4.3 | vaadin/framework | isSelected | server/src/main/java/com/vaadin/ui/Grid.java | b9ba10adaa06a0977c531f878c3f0046b67f9cc0 | 0 |
Analyze the following code function for security vulnerabilities | public static boolean isConfigForWpa3EnterpriseNetwork(WifiConfiguration config) {
return config.isSecurityType(WifiConfiguration.SECURITY_TYPE_EAP_WPA3_ENTERPRISE);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: isConfigForWpa3EnterpriseNetwork
File: service/java/com/android/server/wifi/WifiConfigurationUtil.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21252 | MEDIUM | 5.5 | android | isConfigForWpa3EnterpriseNetwork | service/java/com/android/server/wifi/WifiConfigurationUtil.java | 50b08ee30e04d185e5ae97a5f717d436fd5a90f3 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
this.menu = menu;
// By returning true we signal let Android know that we want the menu
// to be displayed
return nativeMenu && Display.isInitialized() && Display.getInstance().getCurrent() != null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onCreateOptionsMenu
File: Ports/Android/src/com/codename1/impl/android/CodenameOneActivity.java
Repository: codenameone/CodenameOne
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2022-4903 | MEDIUM | 5.1 | codenameone/CodenameOne | onCreateOptionsMenu | Ports/Android/src/com/codename1/impl/android/CodenameOneActivity.java | dad49c9ef26a598619fc48d2697151a02987d478 | 0 |
Analyze the following code function for security vulnerabilities | @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (DeviceFormFactor.isTablet(getContext())) {
// Use the same image transform matrix as the navigation icon to ensure the same
// scaling, which requires centering vertically based on the height of the
// navigation icon view and not the image itself.
canvas.save();
mSuggestionIconLeft = getSuggestionIconLeftPosition();
canvas.translate(
mSuggestionIconLeft,
(getMeasuredHeight() - mNavigationButton.getMeasuredHeight()) / 2f);
canvas.concat(mNavigationButton.getImageMatrix());
mSuggestionIcon.draw(canvas);
canvas.restore();
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onDraw
File: chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-254"
] | CVE-2016-5163 | MEDIUM | 4.3 | chromium | onDraw | chrome/android/java/src/org/chromium/chrome/browser/omnibox/SuggestionView.java | 3bd33fee094e863e5496ac24714c558bd58d28ef | 0 |
Analyze the following code function for security vulnerabilities | @Column(name = "url")
public String getUrl() {
return this.url;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getUrl
File: publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/sys/SysModule.java
Repository: sanluan/PublicCMS
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2018-18927 | LOW | 3.5 | sanluan/PublicCMS | getUrl | publiccms-parent/publiccms-core/src/main/java/com/publiccms/entities/sys/SysModule.java | 2b411dc2821c69539138aaf7632b938b659a58fa | 0 |
Analyze the following code function for security vulnerabilities | void flush() throws IOException {
if (mSocketOS == null) throw new IOException("flush is called on null OutputStream");
if (VDBG) Log.d(TAG, "flush: " + mSocketOS);
mSocketOS.flush();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: flush
File: core/java/android/bluetooth/BluetoothSocket.java
Repository: Genymobile/f2ut_platform_frameworks_base
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2014-9908 | LOW | 3.3 | Genymobile/f2ut_platform_frameworks_base | flush | core/java/android/bluetooth/BluetoothSocket.java | f24cec326f5f65c693544fb0b92c37f633bacda2 | 0 |
Analyze the following code function for security vulnerabilities | public List<EnforcingUser> getUserRestrictionSources(String restriction,
@UserIdInt int userId) {
PolicyDefinition<Boolean> policy =
PolicyDefinition.getPolicyDefinitionForUserRestriction(restriction);
Set<EnforcingAdmin> localAdmins =
mDevicePolicyEngine.getLocalPoliciesSetByAdmins(policy, userId).keySet();
Set<EnforcingAdmin> globalAdmins =
mDevicePolicyEngine.getGlobalPoliciesSetByAdmins(policy).keySet();
List<EnforcingUser> enforcingUsers = new ArrayList();
enforcingUsers.addAll(getEnforcingUsers(localAdmins));
enforcingUsers.addAll(getEnforcingUsers(globalAdmins));
return enforcingUsers;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getUserRestrictionSources
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-40089 | HIGH | 7.8 | android | getUserRestrictionSources | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | e2e05f488da6abc765a62e7faf10cb74e729732e | 0 |
Analyze the following code function for security vulnerabilities | public void addExtras(Bundle extras) {
super.addExtras(extras);
extras.putInt(EXTRA_CALL_TYPE, mCallType);
extras.putBoolean(EXTRA_CALL_IS_VIDEO, mIsVideo);
extras.putParcelable(EXTRA_CALL_PERSON, mPerson);
if (mVerificationIcon != null) {
extras.putParcelable(EXTRA_VERIFICATION_ICON, mVerificationIcon);
}
if (mVerificationText != null) {
extras.putCharSequence(EXTRA_VERIFICATION_TEXT, mVerificationText);
}
if (mAnswerIntent != null) {
extras.putParcelable(EXTRA_ANSWER_INTENT, mAnswerIntent);
}
if (mDeclineIntent != null) {
extras.putParcelable(EXTRA_DECLINE_INTENT, mDeclineIntent);
}
if (mHangUpIntent != null) {
extras.putParcelable(EXTRA_HANG_UP_INTENT, mHangUpIntent);
}
if (mAnswerButtonColor != null) {
extras.putInt(EXTRA_ANSWER_COLOR, mAnswerButtonColor);
}
if (mDeclineButtonColor != null) {
extras.putInt(EXTRA_DECLINE_COLOR, mDeclineButtonColor);
}
fixTitleAndTextExtras(extras);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: addExtras
File: core/java/android/app/Notification.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-21288 | MEDIUM | 5.5 | android | addExtras | core/java/android/app/Notification.java | 726247f4f53e8cc0746175265652fa415a123c0c | 0 |
Analyze the following code function for security vulnerabilities | public String getBasePath() {
return basePath;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getBasePath
File: samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java
Repository: OpenAPITools/openapi-generator
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2021-21430 | LOW | 2.1 | OpenAPITools/openapi-generator | getBasePath | samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java | 2c576483f26f85b3979c6948a131f585c237109a | 0 |
Analyze the following code function for security vulnerabilities | private HttpSessionDestructionContext getSessionDestructionContext() {
if (sessionDestructionContextCache == null) {
this.sessionDestructionContextCache = beanManager.instance().select(HttpSessionDestructionContext.class).get();
}
return sessionDestructionContextCache;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getSessionDestructionContext
File: impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java
Repository: weld/core
The code follows secure coding practices. | [
"CWE-362"
] | CVE-2014-8122 | MEDIUM | 4.3 | weld/core | getSessionDestructionContext | impl/src/main/java/org/jboss/weld/servlet/HttpContextLifecycle.java | 8e413202fa1af08c09c580f444e4fd16874f9c65 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void onAuthenticationFailed() {
handleFingerprintAuthFailed();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onAuthenticationFailed
File: packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-3917 | HIGH | 7.2 | android | onAuthenticationFailed | packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java | f5334952131afa835dd3f08601fb3bced7b781cd | 0 |
Analyze the following code function for security vulnerabilities | @Nullable
private IJsonParsePosition _getCurrentParsePos ()
{
return m_bTrackPosition ? m_aParsePos.getClone () : null;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: _getCurrentParsePos
File: ph-json/src/main/java/com/helger/json/parser/JsonParser.java
Repository: phax/ph-commons
The code follows secure coding practices. | [
"CWE-787"
] | CVE-2023-34612 | HIGH | 7.5 | phax/ph-commons | _getCurrentParsePos | ph-json/src/main/java/com/helger/json/parser/JsonParser.java | 02a4d034dcfb2b6e1796b25f519bf57a6796edce | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void removeExpired(RealmModel realm) {
int expiredOffline = Time.currentTime() - realm.getOfflineSessionIdleTimeout() - SessionTimeoutHelper.PERIODIC_CLEANER_IDLE_TIMEOUT_WINDOW_SECONDS;
// prefer client session timeout if set
int expiredClientOffline = expiredOffline;
if (realm.getClientOfflineSessionIdleTimeout() > 0) {
expiredClientOffline = Time.currentTime() - realm.getClientOfflineSessionIdleTimeout() - SessionTimeoutHelper.PERIODIC_CLEANER_IDLE_TIMEOUT_WINDOW_SECONDS;
}
String offlineStr = offlineToString(true);
logger.tracef("Trigger removing expired user sessions for realm '%s'", realm.getName());
int cs = em.createNamedQuery("deleteExpiredClientSessions")
.setParameter("realmId", realm.getId())
.setParameter("lastSessionRefresh", expiredClientOffline)
.setParameter("offline", offlineStr)
.executeUpdate();
int us = em.createNamedQuery("deleteExpiredUserSessions")
.setParameter("realmId", realm.getId())
.setParameter("lastSessionRefresh", expiredOffline)
.setParameter("offline", offlineStr)
.executeUpdate();
logger.debugf("Removed %d expired user sessions and %d expired client sessions in realm '%s'", us, cs, realm.getName());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: removeExpired
File: model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProvider.java
Repository: keycloak
The code follows secure coding practices. | [
"CWE-770"
] | CVE-2023-6563 | HIGH | 7.7 | keycloak | removeExpired | model/jpa/src/main/java/org/keycloak/models/jpa/session/JpaUserSessionPersisterProvider.java | 11eb952e1df7cbb95b1e2c101dfd4839a2375695 | 0 |
Analyze the following code function for security vulnerabilities | private boolean allowTextHandleFadeIn() {
if (mTouchScrollInProgress) return false;
if (mPopupZoomer.isShowing()) return false;
return true;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: allowTextHandleFadeIn
File: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | allowTextHandleFadeIn | content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | public File workingdir(File baseFolder) {
if (getFolder() == null) {
return baseFolder;
}
return new File(baseFolder, getFolder());
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: workingdir
File: domain/src/main/java/com/thoughtworks/go/config/materials/ScmMaterial.java
Repository: gocd
The code follows secure coding practices. | [
"CWE-668"
] | CVE-2022-39309 | MEDIUM | 6.5 | gocd | workingdir | domain/src/main/java/com/thoughtworks/go/config/materials/ScmMaterial.java | 691b479f1310034992da141760e9c5d1f5b60e8a | 0 |
Analyze the following code function for security vulnerabilities | @RequestMapping(value = "/**/consoleout.json", method = RequestMethod.GET)
public ModelAndView consoleout(@RequestParam("pipelineName") String pipelineName,
@RequestParam("pipelineCounter") String pipelineCounter,
@RequestParam("stageName") String stageName,
@RequestParam("buildName") String buildName,
@RequestParam(value = "stageCounter", required = false) String stageCounter,
@RequestParam(value = "startLineNumber", required = false) Long start
) {
start = start == null ? 0L : start;
try {
JobIdentifier identifier = restfulService.findJob(pipelineName, pipelineCounter, stageName, stageCounter, buildName);
if (jobInstanceDao.isJobCompleted(identifier) && !consoleService.doesLogExist(identifier)) {
return logsNotFound(identifier);
}
ConsoleConsumer streamer = consoleService.getStreamer(start, identifier);
return new ModelAndView(new ConsoleOutView(streamer, consoleLogCharset));
} catch (Exception e) {
return buildNotFound(pipelineName, pipelineCounter, stageName, stageCounter, buildName);
}
} | Vulnerability Classification:
- CWE: CWE-22
- CVE: CVE-2021-43289
- Severity: MEDIUM
- CVSS Score: 5.0
Description: #000 - Validate stage counter in GETs as well.
Continuation of commit c22e0428164af
Function: consoleout
File: server/src/main/java/com/thoughtworks/go/server/controller/ArtifactsController.java
Repository: gocd
Fixed Code:
@RequestMapping(value = "/**/consoleout.json", method = RequestMethod.GET)
public ModelAndView consoleout(@RequestParam("pipelineName") String pipelineName,
@RequestParam("pipelineCounter") String pipelineCounter,
@RequestParam("stageName") String stageName,
@RequestParam("buildName") String buildName,
@RequestParam(value = "stageCounter", required = false) String stageCounter,
@RequestParam(value = "startLineNumber", required = false) Long start
) {
start = start == null ? 0L : start;
if (!isValidStageCounter(stageCounter)) {
return buildNotFound(pipelineName, pipelineCounter, stageName, stageCounter, buildName);
}
try {
JobIdentifier identifier = restfulService.findJob(pipelineName, pipelineCounter, stageName, stageCounter, buildName);
if (jobInstanceDao.isJobCompleted(identifier) && !consoleService.doesLogExist(identifier)) {
return logsNotFound(identifier);
}
ConsoleConsumer streamer = consoleService.getStreamer(start, identifier);
return new ModelAndView(new ConsoleOutView(streamer, consoleLogCharset));
} catch (Exception e) {
return buildNotFound(pipelineName, pipelineCounter, stageName, stageCounter, buildName);
}
} | [
"CWE-22"
] | CVE-2021-43289 | MEDIUM | 5 | gocd | consoleout | server/src/main/java/com/thoughtworks/go/server/controller/ArtifactsController.java | 4c4bb4780eb0d3fc4cacfc4cfcc0b07e2eaf0595 | 1 |
Analyze the following code function for security vulnerabilities | @CalledByNative
public void activateContents() {
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: activateContents
File: components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java
Repository: chromium
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2014-3159 | MEDIUM | 6.4 | chromium | activateContents | components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java | 98a50b76141f0b14f292f49ce376e6554142d5e2 | 0 |
Analyze the following code function for security vulnerabilities | private void clearDeviceOwnerUserRestriction(UserHandle userHandle) {
// ManagedProvisioning/DPC sets DISALLOW_ADD_USER. Clear to recover to the original state
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER, userHandle)) {
mUserManager.setUserRestriction(UserManager.DISALLOW_ADD_USER, false, userHandle);
}
// When a device owner is set, the system automatically restricts adding a managed profile.
// Remove this restriction when the device owner is cleared.
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_MANAGED_PROFILE, userHandle)) {
mUserManager.setUserRestriction(UserManager.DISALLOW_ADD_MANAGED_PROFILE, false,
userHandle);
}
// When a device owner is set, the system automatically restricts adding a clone profile.
// Remove this restriction when the device owner is cleared.
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_CLONE_PROFILE, userHandle)) {
mUserManager.setUserRestriction(UserManager.DISALLOW_ADD_CLONE_PROFILE, false,
userHandle);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: clearDeviceOwnerUserRestriction
File: services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2023-21284 | MEDIUM | 5.5 | android | clearDeviceOwnerUserRestriction | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | ed3f25b7222d4cff471f2b7d22d1150348146957 | 0 |
Analyze the following code function for security vulnerabilities | @ProxyFromPrimaryToCurrentUser
public void onStart() {
// Initialize some static datastructures
TaskStackViewLayoutAlgorithm.initializeCurve();
// Load the header bar layout
reloadHeaderBarLayout(true);
// When we start, preload the data associated with the previous recent tasks.
// We can use a new plan since the caches will be the same.
RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
RecentsTaskLoadPlan plan = loader.createLoadPlan(mContext);
loader.preloadTasks(plan, true /* isTopTaskHome */);
RecentsTaskLoadPlan.Options launchOpts = new RecentsTaskLoadPlan.Options();
launchOpts.numVisibleTasks = loader.getApplicationIconCacheSize();
launchOpts.numVisibleTaskThumbnails = loader.getThumbnailCacheSize();
launchOpts.onlyLoadForCache = true;
loader.loadTasks(mContext, plan, launchOpts);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: onStart
File: packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
Repository: android
The code follows secure coding practices. | [
"CWE-264"
] | CVE-2016-0813 | MEDIUM | 6.6 | android | onStart | packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java | 16a76dadcc23a13223e9c2216dad1fe5cad7d6e1 | 0 |
Analyze the following code function for security vulnerabilities | public void setCertURL(String certURL) {
this.certURL = certURL;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setCertURL
File: base/common/src/main/java/com/netscape/certsrv/cert/CertRequestInfo.java
Repository: dogtagpki/pki
The code follows secure coding practices. | [
"CWE-611"
] | CVE-2022-2414 | HIGH | 7.5 | dogtagpki/pki | setCertURL | base/common/src/main/java/com/netscape/certsrv/cert/CertRequestInfo.java | 16deffdf7548e305507982e246eb9fd1eac414fd | 0 |
Analyze the following code function for security vulnerabilities | public static Object callPrivateMethod(Object obj, String methodName, Class<?>[] classes, Object[] args)
{
try {
Method method = obj.getClass().getDeclaredMethod(methodName, classes);
method.setAccessible(true);
return method.invoke(obj, args);
} catch (IllegalAccessException e) {
LOGGER.error("Failed to call private method [{}]: [{}]", methodName, e);
return null;
} catch (NoSuchMethodException e) {
return null;
} catch (InvocationTargetException e) {
LOGGER.error("Private method [{}] failed: [{}]", methodName, e);
return null;
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: callPrivateMethod
File: xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java
Repository: xwiki/xwiki-platform
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2021-32620 | MEDIUM | 4 | xwiki/xwiki-platform | callPrivateMethod | xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java | f9a677408ffb06f309be46ef9d8df1915d9099a4 | 0 |
Analyze the following code function for security vulnerabilities | @Override
// TODO: API should just be about changing windowing modes...
public void moveTasksToFullscreenStack(int fromStackId, boolean onTop) {
enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_STACKS,
"moveTasksToFullscreenStack()");
synchronized (this) {
final long origId = Binder.clearCallingIdentity();
try {
final ActivityStack stack = mStackSupervisor.getStack(fromStackId);
if (stack != null){
if (!stack.isActivityTypeStandardOrUndefined()) {
throw new IllegalArgumentException(
"You can't move tasks from non-standard stacks.");
}
mStackSupervisor.moveTasksToFullscreenStackLocked(stack, onTop);
}
} finally {
Binder.restoreCallingIdentity(origId);
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: moveTasksToFullscreenStack
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2018-9492 | HIGH | 7.2 | android | moveTasksToFullscreenStack | services/core/java/com/android/server/am/ActivityManagerService.java | 962fb40991f15be4f688d960aa00073683ebdd20 | 0 |
Analyze the following code function for security vulnerabilities | public void restoreDisabledSystemPackageLIF(DeletePackageAction action,
@NonNull int[] allUserHandles, boolean writeSettings) throws SystemDeleteException {
final PackageSetting deletedPs = action.mDeletingPs;
final PackageRemovedInfo outInfo = action.mRemovedInfo;
final PackageSetting disabledPs = action.mDisabledPs;
synchronized (mPm.mLock) {
// NOTE: The system package always needs to be enabled; even if it's for
// a compressed stub. If we don't, installing the system package fails
// during scan [scanning checks the disabled packages]. We will reverse
// this later, after we've "installed" the stub.
// Reinstate the old system package
mPm.mSettings.enableSystemPackageLPw(disabledPs.getPkg().getPackageName());
// Remove any native libraries from the upgraded package.
PackageManagerServiceUtils.removeNativeBinariesLI(deletedPs);
}
// Install the system package
if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs);
try {
synchronized (mPm.mInstallLock) {
final int[] origUsers = outInfo == null ? null : outInfo.mOrigUsers;
installPackageFromSystemLIF(disabledPs.getPathString(), allUserHandles,
origUsers, writeSettings);
}
} catch (PackageManagerException e) {
Slog.w(TAG, "Failed to restore system package:" + deletedPs.getPackageName() + ": "
+ e.getMessage());
// TODO(b/194319951): can we avoid this; throw would come from scan...
throw new SystemDeleteException(e);
} finally {
if (disabledPs.getPkg().isStub()) {
// We've re-installed the stub; make sure it's disabled here. If package was
// originally enabled, we'll install the compressed version of the application
// and re-enable it afterward.
synchronized (mPm.mLock) {
disableStubPackage(action, deletedPs, allUserHandles);
}
}
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: restoreDisabledSystemPackageLIF
File: services/core/java/com/android/server/pm/InstallPackageHelper.java
Repository: android
The code follows secure coding practices. | [
"CWE-862"
] | CVE-2023-21257 | HIGH | 7.8 | android | restoreDisabledSystemPackageLIF | services/core/java/com/android/server/pm/InstallPackageHelper.java | 1aec7feaf07e6d4568ca75d18158445dbeac10f6 | 0 |
Analyze the following code function for security vulnerabilities | public static long toLong(@Nullable String s) throws SQLException {
if (s != null) {
try {
s = s.trim();
return Long.parseLong(s);
} catch (NumberFormatException e) {
try {
BigDecimal n = new BigDecimal(s);
BigInteger i = n.toBigInteger();
int gt = i.compareTo(LONGMAX);
int lt = i.compareTo(LONGMIN);
if (gt > 0 || lt < 0) {
throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "long", s),
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
}
return i.longValue();
} catch (NumberFormatException ne) {
throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "long", s),
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE);
}
}
}
return 0; // SQL NULL
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: toLong
File: pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
Repository: pgjdbc
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2022-31197 | HIGH | 8 | pgjdbc | toLong | pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java | 739e599d52ad80f8dcd6efedc6157859b1a9d637 | 0 |
Analyze the following code function for security vulnerabilities | public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
Object val = this.opt(key);
return objectToBigDecimal(val, defaultValue);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: optBigDecimal
File: src/main/java/org/json/JSONObject.java
Repository: stleary/JSON-java
The code follows secure coding practices. | [
"CWE-770"
] | CVE-2023-5072 | HIGH | 7.5 | stleary/JSON-java | optBigDecimal | src/main/java/org/json/JSONObject.java | 661114c50dcfd53bb041aab66f14bb91e0a87c8a | 0 |
Analyze the following code function for security vulnerabilities | public synchronized HttpRedirect doQuietDown() throws IOException {
try {
return doQuietDown(false,0);
} catch (InterruptedException e) {
throw new AssertionError(); // impossible
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: doQuietDown
File: core/src/main/java/jenkins/model/Jenkins.java
Repository: jenkinsci/jenkins
The code follows secure coding practices. | [
"CWE-79"
] | CVE-2014-2065 | MEDIUM | 4.3 | jenkinsci/jenkins | doQuietDown | core/src/main/java/jenkins/model/Jenkins.java | a0b00508eeb74d7033dc4100eb382df4e8fa72e7 | 0 |
Analyze the following code function for security vulnerabilities | private List<ResolveInfo> queryIntentReceivers(Intent intent, int userId) {
final long identity = Binder.clearCallingIdentity();
try {
int flags = PackageManager.GET_META_DATA;
// Widgets referencing shared libraries need to have their
// dependencies loaded.
flags |= PackageManager.GET_SHARED_LIBRARY_FILES;
return mPackageManager.queryIntentReceivers(intent,
intent.resolveTypeIfNeeded(mContext.getContentResolver()),
flags, userId);
} catch (RemoteException re) {
return Collections.emptyList();
} finally {
Binder.restoreCallingIdentity(identity);
}
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: queryIntentReceivers
File: services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java
Repository: android
The code follows secure coding practices. | [
"CWE-284"
] | CVE-2015-1541 | MEDIUM | 4.3 | android | queryIntentReceivers | services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java | 0b98d304c467184602b4c6bce76fda0b0274bc07 | 0 |
Analyze the following code function for security vulnerabilities | @Beta
public static BufferedWriter newWriter(File file, Charset charset) throws FileNotFoundException {
checkNotNull(file);
checkNotNull(charset);
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), charset));
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: newWriter
File: guava/src/com/google/common/io/Files.java
Repository: google/guava
The code follows secure coding practices. | [
"CWE-732"
] | CVE-2020-8908 | LOW | 2.1 | google/guava | newWriter | guava/src/com/google/common/io/Files.java | fec0dbc4634006a6162cfd4d0d09c962073ddf40 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public boolean hasNext() {
return current.after != head;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: hasNext
File: core/src/main/java/com/linecorp/armeria/common/HttpHeadersBase.java
Repository: line/armeria
The code follows secure coding practices. | [
"CWE-74"
] | CVE-2019-16771 | MEDIUM | 5 | line/armeria | hasNext | core/src/main/java/com/linecorp/armeria/common/HttpHeadersBase.java | b597f7a865a527a84ee3d6937075cfbb4470ed20 | 0 |
Analyze the following code function for security vulnerabilities | public int getEllipsizedWidth() {
return mWidth;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getEllipsizedWidth
File: core/java/android/text/Layout.java
Repository: android
The code follows secure coding practices. | [
"CWE-20"
] | CVE-2018-9452 | MEDIUM | 4.3 | android | getEllipsizedWidth | core/java/android/text/Layout.java | 3b6f84b77c30ec0bab5147b0cffc192c86ba2634 | 0 |
Analyze the following code function for security vulnerabilities | protected ClickHouseNode setManager(ClickHouseNodeManager m) {
this.manager.getAndUpdate(v -> {
boolean sameManager = Objects.equals(v, m);
if (v != null && !sameManager) {
v.update(ClickHouseNode.this, Status.STANDALONE);
}
return sameManager ? v : null;
});
if (m != null && manager.compareAndSet(null, m)) {
m.update(ClickHouseNode.this, Status.MANAGED);
}
return this;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setManager
File: clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java
Repository: ClickHouse/clickhouse-java
The code follows secure coding practices. | [
"CWE-209"
] | CVE-2024-23689 | HIGH | 8.8 | ClickHouse/clickhouse-java | setManager | clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNode.java | 4f8d9303eb991b39ec7e7e34825241efa082238a | 0 |
Analyze the following code function for security vulnerabilities | @Override
public Collection<String> queryParamNames() {
return context.queryParams().names();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: queryParamNames
File: independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
Repository: quarkusio/quarkus
The code follows secure coding practices. | [
"CWE-863"
] | CVE-2022-0981 | MEDIUM | 6.5 | quarkusio/quarkus | queryParamNames | independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java | 96c64fd8f09c02a497e2db366c64dd9196582442 | 0 |
Analyze the following code function for security vulnerabilities | @Override
public byte[] getPreferredActivityBackup(int userId) {
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
throw new SecurityException("Only the system may call getPreferredActivityBackup()");
}
ByteArrayOutputStream dataStream = new ByteArrayOutputStream();
try {
final XmlSerializer serializer = new FastXmlSerializer();
serializer.setOutput(dataStream, StandardCharsets.UTF_8.name());
serializer.startDocument(null, true);
serializer.startTag(null, TAG_PREFERRED_BACKUP);
synchronized (mPackages) {
mSettings.writePreferredActivitiesLPr(serializer, userId, true);
}
serializer.endTag(null, TAG_PREFERRED_BACKUP);
serializer.endDocument();
serializer.flush();
} catch (Exception e) {
if (DEBUG_BACKUP) {
Slog.e(TAG, "Unable to write preferred activities for backup", e);
}
return null;
}
return dataStream.toByteArray();
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: getPreferredActivityBackup
File: services/core/java/com/android/server/pm/PackageManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-119"
] | CVE-2016-2497 | HIGH | 7.5 | android | getPreferredActivityBackup | services/core/java/com/android/server/pm/PackageManagerService.java | a75537b496e9df71c74c1d045ba5569631a16298 | 0 |
Analyze the following code function for security vulnerabilities | public static void extract(ZipFile zipFile, File destDir)
throws IOException
{
assert destDir.isDirectory();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
writeEntry(zipFile, entry, destDir);
}
} | Vulnerability Classification:
- CWE: CWE-22
- CVE: CVE-2018-20227
- Severity: MEDIUM
- CVSS Score: 6.4
Description: Verify that zip file entries don't try to escape the parent dir + test
Signed-off-by: Bart Hanssens <bart.hanssens@bosa.fgov.be>
Function: extract
File: util/src/main/java/org/eclipse/rdf4j/common/io/ZipUtil.java
Repository: eclipse-rdf4j/rdf4j
Fixed Code:
public static void extract(ZipFile zipFile, File destDir) throws IOException {
assert destDir.isDirectory();
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
writeEntry(zipFile, entry, destDir);
}
} | [
"CWE-22"
] | CVE-2018-20227 | MEDIUM | 6.4 | eclipse-rdf4j/rdf4j | extract | util/src/main/java/org/eclipse/rdf4j/common/io/ZipUtil.java | df15a4d7a8f2789c043b27c9eafe1b30316cfa79 | 1 |
Analyze the following code function for security vulnerabilities | private DependencyInjector dependencyInjectorOrReflective() {
if (dependencyInjector != null) {
return dependencyInjector;
}
final ReflectiveDependencyInjector reflectiveDependencyInjector = new ReflectiveDependencyInjector();
shutdownSupports.add(ShutdownSupport.of(reflectiveDependencyInjector));
return reflectiveDependencyInjector;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: dependencyInjectorOrReflective
File: core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
Repository: line/armeria
The code follows secure coding practices. | [
"CWE-400"
] | CVE-2023-44487 | HIGH | 7.5 | line/armeria | dependencyInjectorOrReflective | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | df7f85824a62e997b910b5d6194a3335841065fd | 0 |
Analyze the following code function for security vulnerabilities | boolean executeDrawHandlers(SurfaceControl.Transaction t, int seqId) {
boolean hadHandlers = false;
boolean applyHere = false;
if (t == null) {
t = mTmpTransaction;
applyHere = true;
}
final List<DrawHandler> handlersToRemove = new ArrayList<>();
// Iterate forwards to ensure we process in the same order
// we added.
for (int i = 0; i < mDrawHandlers.size(); i++) {
final DrawHandler h = mDrawHandlers.get(i);
if (h.mSeqId <= seqId) {
h.mConsumer.accept(t);
handlersToRemove.add(h);
hadHandlers = true;
}
}
for (int i = 0; i < handlersToRemove.size(); i++) {
final DrawHandler h = handlersToRemove.get(i);
mDrawHandlers.remove(h);
}
if (hadHandlers) {
mWmService.mH.removeMessages(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this);
}
if (applyHere) {
t.apply();
}
return hadHandlers;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: executeDrawHandlers
File: services/core/java/com/android/server/wm/WindowState.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-35674 | HIGH | 7.8 | android | executeDrawHandlers | services/core/java/com/android/server/wm/WindowState.java | 7428962d3b064ce1122809d87af65099d1129c9e | 0 |
Analyze the following code function for security vulnerabilities | @Override
public void setFocusedRootTask(int taskId) {
mActivityTaskManager.setFocusedRootTask(taskId);
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: setFocusedRootTask
File: services/core/java/com/android/server/am/ActivityManagerService.java
Repository: android
The code follows secure coding practices. | [
"CWE-Other"
] | CVE-2023-21292 | MEDIUM | 5.5 | android | setFocusedRootTask | services/core/java/com/android/server/am/ActivityManagerService.java | d10b27e539f7bc91c2360d429b9d05f05274670d | 0 |
Analyze the following code function for security vulnerabilities | private Map<String, Object> packageSingleActivitiInfo(ActivityImpl activity, ProcessInstance processInstance,
boolean currentActiviti) throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
Map<String, Object> activityInfo = new HashMap<String, Object>();
activityInfo.put("currentActiviti", currentActiviti);
setPosition(activity, activityInfo);
setWidthAndHeight(activity, activityInfo);
Map<String, Object> properties = activity.getProperties();
vars.put("节点名称", properties.get("name"));
vars.put("任务类型", ActUtils.parseToZhType(properties.get("type").toString()));
ActivityBehavior activityBehavior = activity.getActivityBehavior();
logger.debug("activityBehavior={}", activityBehavior);
if (activityBehavior instanceof UserTaskActivityBehavior) {
Task currentTask = null;
// 当前节点的task
if (currentActiviti) {
currentTask = getCurrentTaskInfo(processInstance);
}
// 当前任务的分配角色
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
Set<Expression> candidateGroupIdExpressions = taskDefinition.getCandidateGroupIdExpressions();
if (!candidateGroupIdExpressions.isEmpty()) {
// 任务的处理角色
setTaskGroup(vars, candidateGroupIdExpressions);
// 当前处理人
if (currentTask != null) {
setCurrentTaskAssignee(vars, currentTask);
}
}
}
vars.put("节点说明", properties.get("documentation"));
String description = activity.getProcessDefinition().getDescription();
vars.put("描述", description);
logger.debug("trace variables: {}", vars);
activityInfo.put("vars", vars);
return activityInfo;
} | No Vulnerability Detected:
This code is secure and does not contain known vulnerabilities.
Function: packageSingleActivitiInfo
File: src/main/java/com/thinkgem/jeesite/modules/act/service/ActTaskService.java
Repository: thinkgem/jeesite
The code follows secure coding practices. | [
"CWE-89"
] | CVE-2023-34601 | CRITICAL | 9.8 | thinkgem/jeesite | packageSingleActivitiInfo | src/main/java/com/thinkgem/jeesite/modules/act/service/ActTaskService.java | 30750011b49f7c8d45d0f3ab13ed3a1a422655bb | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.