Dataset Viewer
Auto-converted to Parquet Duplicate
func_before
stringlengths
12
22.8k
func_after
stringlengths
11
24.7k
commit_msg
stringlengths
1
32.6k
commit_url
stringlengths
48
124
cve_id
stringclasses
530 values
cwe_id
stringclasses
134 values
file_name
stringlengths
4
244
vulnerability_score
int64
0
4
extension
stringclasses
6 values
is_test
bool
1 class
date
stringdate
1999-11-10 02:42:49
2024-01-29 16:00:57
function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return true;return false}
function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}
Update vendor libs
https://github.com/cockpit-hq/cockpit/commit/690016208850f2d788ebc3c67884d4c692587eb8
CVE-2023-1160
['CWE-1103']
modules/App/assets/vendor/lodash.js
0
js
false
2023-02-22T01:10:02Z
private CompletableFuture<String> authorize() { HttpClient.DerivedClientBuilder builder = client.newBuilder(); builder.addOrReplaceInterceptor(TokenRefreshInterceptor.NAME, null); HttpClient clone = builder.build(); URL url; try { url = new URL(URLUtils.join(config.getMasterUrl(), AUTHORIZATION_SERVER_PATH)); } catch (MalformedURLException e) { throw KubernetesClientException.launderThrowable(e); } CompletableFuture<HttpResponse<String>> responseFuture = clone.sendAsync(clone.newHttpRequestBuilder().url(url).build(), String.class); return responseFuture.thenCompose(response -> { if (!response.isSuccessful() || response.body() == null) { throw new KubernetesClientException("Unexpected response (" + response.code() + " " + response.message() + ")"); } String body = response.body(); try { JsonNode jsonResponse = Serialization.jsonMapper().readTree(body); String authorizationServer = jsonResponse.get("authorization_endpoint").asText(); URL authorizeQuery = new URL(authorizationServer + AUTHORIZE_QUERY); String credential = HttpClientUtils.basicCredentials(config.getUsername(), config.getPassword()); return clone.sendAsync(client.newHttpRequestBuilder().url(authorizeQuery).setHeader(AUTHORIZATION, credential).build(), String.class); } catch (Exception e) { throw KubernetesClientException.launderThrowable(e); } }).thenApply(response -> { HttpResponse<?> responseOrPrevious = response.previousResponse().isPresent() ? response.previousResponse().get() : response; List<String> location = responseOrPrevious.headers(LOCATION); String token = !location.isEmpty() ? location.get(0) : null; if (token == null || token.isEmpty()) { throw new KubernetesClientException("Unexpected response (" + responseOrPrevious.code() + " " + responseOrPrevious.message() + "), to the authorization request. Missing header:[" + LOCATION + "]!"); } token = token.substring(token.indexOf(BEFORE_TOKEN) + BEFORE_TOKEN.length()); token = token.substring(0, token.indexOf(AFTER_TOKEN)); return token; }); }
private CompletableFuture<String> authorize() { HttpClient.DerivedClientBuilder builder = client.newBuilder(); builder.addOrReplaceInterceptor(TokenRefreshInterceptor.NAME, null); HttpClient clone = builder.build(); URL url; try { url = new URL(URLUtils.join(config.getMasterUrl(), AUTHORIZATION_SERVER_PATH)); } catch (MalformedURLException e) { throw KubernetesClientException.launderThrowable(e); } CompletableFuture<HttpResponse<String>> responseFuture = clone.sendAsync(clone.newHttpRequestBuilder().url(url).build(), String.class); return responseFuture.thenCompose(response -> { if (!response.isSuccessful() || response.body() == null) { throw new KubernetesClientException("Unexpected response (" + response.code() + " " + response.message() + ")"); } String body = response.body(); try { JsonNode jsonResponse = Serialization.jsonMapper().readTree(body); String authorizationServer = jsonResponse.get("authorization_endpoint").asText(); URL authorizeQuery = new URL(authorizationServer + AUTHORIZE_QUERY); String credential = HttpClientUtils.basicCredentials(config.getUsername(), config.getPassword()); return clone.sendAsync(client.newHttpRequestBuilder().url(authorizeQuery).setHeader(AUTHORIZATION, credential).build(), String.class); } catch (Exception e) { throw KubernetesClientException.launderThrowable(e); } }).thenApply(response -> { HttpResponse<?> responseOrPrevious = response.previousResponse().isPresent() ? response.previousResponse().get() : response; List<String> location = responseOrPrevious.headers(LOCATION); String token = !location.isEmpty() ? location.get(0) : null; if (token == null || token.isEmpty()) { throw new KubernetesClientException("Unexpected response (" + responseOrPrevious.code() + " " + responseOrPrevious.message() + "), to the authorization request. Missing header:[" + LOCATION + "]. More than likely the username / password are not correct."); } token = token.substring(token.indexOf(BEFORE_TOKEN) + BEFORE_TOKEN.length()); token = token.substring(0, token.indexOf(AFTER_TOKEN)); return token; }); }
review: address comments regarding test scenarios for PATCH Signed-off-by: Marc Nuri <marc@marcnuri.com>
https://github.com/fabric8io/kubernetes-client/commit/88a9dde129610a174fa801eedcb0e87395138e70
null
null
openshift-client/src/main/java/io/fabric8/openshift/client/internal/OpenShiftOAuthInterceptor.java
0
java
false
2022-12-20T15:30:05Z
function m(u,F){G=!1;var C=null!=u.Text&&u.Text.t?u.Text:null!=u.Value&&u.Value.t?u.Value: null!=u.Lane_0&&u.Lane_0.t?u.Lane_0:null;null==C&&null!=u.State?u.State.t&&(C=u.State):null==C&&null!=u.Note?u.Note.t&&(C=u.Note):null==C&&null!=u.Title?u.Title.t&&(C=u.Title):u.t&&(C=u);null==C&&null!=u.TextAreas?null!=u.TextAreas.Text&&null!=u.TextAreas.Text.Value&&u.TextAreas.Text.Value.t&&(C=u.TextAreas.Text.Value):null==C&&null!=u.t0&&u.t0.t&&(C=u.t0);if(null!=C){if(null!=C.t){var t=C.t;t=t.replace(/\u2028/g,"\n");C=C.m;try{/ /.test(t)&&(LucidImporter.hasUnknownShapes=!0);for(var e=0;e<C.length;e++)if(0< C[e].s||null!=C[e].e&&C[e].e<t.length||"t"==C[e].n||"ac"==C[e].n||"lk"==C[e].n){G=!0;break}if(G=G||F)return B(t,C,u)}catch(N){console.log(N)}t=t.replace(/</g,"&lt;");return t=t.replace(/>/g,"&gt;")}if(null!=C.Value&&null!=C.Value.t)return C.Value.t=C.Value.t.replace(/</g,"&lt;"),C.Value.t=C.Value.t.replace(/>/g,"&gt;"),C.Value.t}return""}
function m(u,F){G=!1;var D=null!=u.Text&&u.Text.t?u.Text:null!=u.Value&&u.Value.t?u.Value: null!=u.Lane_0&&u.Lane_0.t?u.Lane_0:null;null==D&&null!=u.State?u.State.t&&(D=u.State):null==D&&null!=u.Note?u.Note.t&&(D=u.Note):null==D&&null!=u.Title?u.Title.t&&(D=u.Title):u.t&&(D=u);null==D&&null!=u.TextAreas?null!=u.TextAreas.Text&&null!=u.TextAreas.Text.Value&&u.TextAreas.Text.Value.t&&(D=u.TextAreas.Text.Value):null==D&&null!=u.t0&&u.t0.t&&(D=u.t0);if(null!=D){if(null!=D.t){var t=D.t;t=t.replace(/\u2028/g,"\n");D=D.m;try{/ /.test(t)&&(LucidImporter.hasUnknownShapes=!0);for(var e=0;e<D.length;e++)if(0< D[e].s||null!=D[e].e&&D[e].e<t.length||"t"==D[e].n||"ac"==D[e].n||"lk"==D[e].n){G=!0;break}if(G=G||F)return B(t,D,u)}catch(O){console.log(O)}t=t.replace(/</g,"&lt;");return t=t.replace(/>/g,"&gt;")}if(null!=D.Value&&null!=D.Value.t)return D.Value.t=D.Value.t.replace(/</g,"&lt;"),D.Value.t=D.Value.t.replace(/>/g,"&gt;"),D.Value.t}return""}
21.6.3 release
https://github.com/jgraph/drawio/commit/1db2c2c653aa245d175d30c210239e3946bfcb95
CVE-2023-3973
['CWE-79']
src/main/webapp/js/extensions.min.js
0
js
false
2023-07-18T17:20:28Z
void registerServer() { VersionAgnosticCommandManager.get().registerServerCommand( CommandManager.literal(Modget.NAMESPACE_SERVER) .then(CommandManager.literal(COMMAND_PARTS[0]) .then(CommandManager.literal(COMMAND_PARTS[1]) .then(CommandManager.argument(COMMAND_PARTS[2], StringArgumentType.greedyString()) .requires(source -> source.hasPermissionLevel(PERMISSION_LEVEL)) .executes(context -> { PlayerEntity player = context.getSource().getPlayer(); new StartThread(player, StringArgumentType.getString(context, COMMAND_PARTS[2])).start(); return 1; }) ) ) ) ); }
void registerServer() { VersionAgnosticServerCommandManager.get().register( CommandManager.literal(Modget.NAMESPACE_SERVER) .then(CommandManager.literal(COMMAND_PARTS[0]) .then(CommandManager.literal(COMMAND_PARTS[1]) .then(CommandManager.argument(COMMAND_PARTS[2], StringArgumentType.greedyString()) .requires(source -> source.hasPermissionLevel(PERMISSION_LEVEL)) .executes(context -> { PlayerEntity player = context.getSource().getPlayer(); new StartThread(player, StringArgumentType.getString(context, COMMAND_PARTS[2])).start(); return 1; }) ) ) ) ); }
Don't upload modget-core build artifacts
https://github.com/ReviversMC/modget-minecraft/commit/17f5235f98d112ceb086533d1c4901e7a2a3fce9
null
null
modget-core/src/main/java/com/github/reviversmc/modget/minecraft/command/ReposAddCommand.java
0
java
false
2022-08-12T14:50:34Z
@Override public void run() { // The first time running this, need to setup the block list if a reset: if ( position == 0 ) { if ( runSetupCancelAutoResets() ) { // If the reset should be canceled then just return, and that will // terminate the reset. There is nothing else that needs to be done. return; } } List<MineTargetPrisonBlock> targetBlocks = mine.getMineTargetPrisonBlocks(); int pageEndPosition = position + getConfigAsyncResetPageSize(); while ( position < pageEndPosition ) { int endIndex = position + getConfigSyncSubPageSlice(); if ( endIndex > targetBlocks.size() ) { endIndex = targetBlocks.size(); pageEndPosition = endIndex; } // Isolate the sub-list from the main targetBlocks list: List<MineTargetPrisonBlock> tBlocks = new ArrayList<>(); for (MineTargetPrisonBlock mtpb : targetBlocks.subList( position, endIndex )) { tBlocks.add(mtpb); } int size = tBlocks.size(); position += size; mine.getWorld().get().setBlocksSynchronously( tBlocks, resetType, getNanos() ); } // Keep resubmitting this task until it is completed: if ( position < targetBlocks.size() ) { submitTaskSync(); } else { // Finished running the task and let it end: runShutdown(); } }
@Override public void run() { // The first time running this, need to setup the block list if a reset: if ( position == 0 ) { if ( runSetupCancelAutoResets() ) { // If the reset should be canceled then just return, and that will // terminate the reset. There is nothing else that needs to be done. return; } } List<MineTargetPrisonBlock> targetBlocks = mine.getMineTargetPrisonBlocks(); int pageEndPosition = position + getConfigAsyncResetPageSize(); while ( position < pageEndPosition ) { int endIndex = position + getConfigSyncSubPageSlice(); if ( endIndex > targetBlocks.size() ) { endIndex = targetBlocks.size(); pageEndPosition = endIndex; } // Isolate the sub-list from the main targetBlocks list: List<MineTargetPrisonBlock> tBlocks = new ArrayList<>(); for (MineTargetPrisonBlock mtpb : targetBlocks.subList( position, endIndex )) { tBlocks.add(mtpb); } int size = tBlocks.size(); position += size; mine.getWorld().get().setBlocksSynchronously( tBlocks, resetType, getNanos() ); } // Keep resubmitting this task until it is completed: if ( position < targetBlocks.size() ) { submitTaskAsyncInternalNextPage(); } else { // Finished running the task and let it end: runShutdown(); } }
Mine resets: Fixed an issue when dealing with zero-block resets on a very small mine, such as a one block mine in that the 5 second delay was preventing from rapid resets. Bypass both 5 second cooldown on resets and blockmatching when 25 blocks or less for the mine size. With running resets in async mode, with rapid resets for a one-block mine, the handling of the block breaks can occur out of order, which will trigger the block mismatch.
https://github.com/PrisonTeam/Prison/commit/a91dbdae13c0bf0874a9d6af970684f0b028a8ae
null
null
prison-mines/src/main/java/tech/mcprison/prison/mines/tasks/MinePagedResetAsyncTask.java
0
java
false
2022-06-20T05:07:28Z
function ViewConsumable() { Object(_var_www_lime25_limesurvey_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_7__["default"])(this, ViewConsumable); /** * Map of consumable elements. If {@link module:engine/view/element~Element element} is used as a key, * {@link module:engine/conversion/viewconsumable~ViewElementConsumables ViewElementConsumables} instance is stored as value. * For {@link module:engine/view/text~Text text nodes} and * {@link module:engine/view/documentfragment~DocumentFragment document fragments} boolean value is stored as value. * * @protected * @member {Map.<module:engine/conversion/viewconsumable~ViewElementConsumables|Boolean>} */ this._consumables = new Map(); }
function ViewConsumable() { Object(_var_www_limedev_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_7__["default"])(this, ViewConsumable); /** * Map of consumable elements. If {@link module:engine/view/element~Element element} is used as a key, * {@link module:engine/conversion/viewconsumable~ViewElementConsumables ViewElementConsumables} instance is stored as value. * For {@link module:engine/view/text~Text text nodes} and * {@link module:engine/view/documentfragment~DocumentFragment document fragments} boolean value is stored as value. * * @protected * @member {Map.<module:engine/conversion/viewconsumable~ViewElementConsumables|Boolean>} */ this._consumables = new Map(); }
DEV: changed routes in vue.js part questiongroupedit.js and deleted old controller+views
https://github.com/LimeSurvey/LimeSurvey/commit/d7a309bf1a73e95187528982b9db7ec03fee6913
CVE-2020-23710
['CWE-79']
assets/packages/questiongroup/build/js/questiongroupedit.js
0
js
false
2020-06-08T09:23:29Z
public void seslInitConfigurations(Context var1) { ViewConfiguration var2 = ViewConfiguration.get(var1); Resources var3 = var1.getResources(); this.mTouchSlop = var2.getScaledTouchSlop(); this.mSeslTouchSlop = var2.getScaledTouchSlop(); this.mSeslPagingTouchSlop = var2.getScaledPagingTouchSlop(); this.mScaledHorizontalScrollFactor = ViewConfigurationCompat.getScaledHorizontalScrollFactor(var2, var1); this.mScaledVerticalScrollFactor = ViewConfigurationCompat.getScaledVerticalScrollFactor(var2, var1); this.mMinFlingVelocity = var2.getScaledMinimumFlingVelocity(); this.mMaxFlingVelocity = var2.getScaledMaximumFlingVelocity(); this.mHoverTopAreaHeight = (int) (TypedValue.applyDimension(1, 25.0F, var3.getDisplayMetrics()) + 0.5F); this.mHoverBottomAreaHeight = (int) (TypedValue.applyDimension(1, 25.0F, var3.getDisplayMetrics()) + 0.5F); this.mGoToTopBottomPadding = var3.getDimensionPixelSize(R.dimen.sesl_go_to_top_scrollable_view_gap); this.mGoToTopImmersiveBottomPadding = 0; this.mGoToTopSize = var3.getDimensionPixelSize(R.dimen.sesl_go_to_top_scrollable_view_size); this.mGoToTopElevation = var3.getDimensionPixelSize(R.dimen.sesl_go_to_top_elevation); this.mNavigationBarHeight = var3.getDimensionPixelSize(R.dimen.sesl_navigation_bar_height); }
public void seslInitConfigurations(Context var1) { ViewConfiguration var2 = ViewConfiguration.get(var1); Resources var3 = var1.getResources(); this.mTouchSlop = var2.getScaledTouchSlop(); this.mSeslTouchSlop = var2.getScaledTouchSlop(); this.mSeslPagingTouchSlop = var2.getScaledPagingTouchSlop(); this.mScaledHorizontalScrollFactor = ViewConfigurationCompat.getScaledHorizontalScrollFactor(var2, var1); this.mScaledVerticalScrollFactor = ViewConfigurationCompat.getScaledVerticalScrollFactor(var2, var1); this.mMinFlingVelocity = var2.getScaledMinimumFlingVelocity(); this.mMaxFlingVelocity = var2.getScaledMaximumFlingVelocity(); this.mHoverTopAreaHeight = (int) (TypedValue.applyDimension(1, 25.0F, var3.getDisplayMetrics()) + 0.5F); this.mHoverBottomAreaHeight = (int) (TypedValue.applyDimension(1, 25.0F, var3.getDisplayMetrics()) + 0.5F); this.mGoToTopBottomPadding = var3.getDimensionPixelSize(R.dimen.sesl_go_to_top_scrollable_view_gap); this.mGoToTopImmersiveBottomPadding = 0; this.mGoToTopSize = var3.getDimensionPixelSize(R.dimen.sesl_go_to_top_scrollable_view_size); this.mGoToTopElevation = var3.getDimension(R.dimen.sesl_go_to_top_elevation); this.mNavigationBarHeight = var3.getDimensionPixelSize(R.dimen.sesl_navigation_bar_height); }
app: OneUI 4 DetailedColorPicker, GoToTop, Preference text size (#62) * app: OneUI 4 DetailedColorPicker, GoToTop, Preference text size Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com> * app: fix SwipeRefreshLayout scale down anim, night mode DetailedColorPicker tabs Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com> * app: OneUI 4 fast scroller Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com> * app/SwipeRefreshLayout: fix crashes Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com> * app/oneuiexample: there's a SwipeRefreshLayout test in case you didn't notice Signed-off-by: BlackMesa123 <giangrecosalvo9@gmail.com>
https://github.com/OneUIProject/OneUI-Design-Library/commit/7d82261d6821ece4c02d4e8157560a41156436eb
null
null
yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/view/RecyclerView.java
0
java
false
null
function updateRole(userId, meetingId, role) { check(userId, String); check(meetingId, String); check(role, String); const selector = { userId, meetingId, }; const modifier = { $set: { role, }, }; try { UsersPersistentData.update(selector, modifier); } catch (err) { Logger.error(`Updating users persistent data's role to the collection: ${err}`); } }
async function updateRole(userId, meetingId, role) { check(userId, String); check(meetingId, String); check(role, String); const selector = { userId, meetingId, }; const modifier = { $set: { role, }, }; try { await UsersPersistentData.updateAsync(selector, modifier); } catch (err) { Logger.error(`Updating users persistent data's role to the collection: ${err}`); } }
Merge branch 'v2.6.x-release' of github.com:bigbluebutton/bigbluebutton into ssrf-fix
https://github.com/bigbluebutton/bigbluebutton/commit/22de2b49a5d218910923a1048bb73395e53c99bf
CVE-2023-33176
['CWE-918']
bigbluebutton-html5/imports/api/users-persistent-data/server/modifiers/updateRole.js
0
js
false
2023-04-13T12:40:07Z
def invoke_defer_method(self): """Method to easily redefine triggers which are being used in child classes.""" trigger_start_time = utcnow() self.defer( trigger=KubernetesPodTrigger( pod_name=self.pod.metadata.name, pod_namespace=self.pod.metadata.namespace, trigger_start_time=trigger_start_time, kubernetes_conn_id=self.kubernetes_conn_id, cluster_context=self.cluster_context, config_dict=self._config_dict, in_cluster=self.in_cluster, poll_interval=self.poll_interval, should_delete_pod=self.is_delete_operator_pod, get_logs=self.get_logs, startup_timeout=self.startup_timeout_seconds, base_container_name=self.base_container_name, ), method_name="execute_complete", )
def invoke_defer_method(self): """Method to easily redefine triggers which are being used in child classes.""" trigger_start_time = utcnow() self.defer( trigger=KubernetesPodTrigger( pod_name=self.pod.metadata.name, pod_namespace=self.pod.metadata.namespace, trigger_start_time=trigger_start_time, kubernetes_conn_id=self.kubernetes_conn_id, cluster_context=self.cluster_context, config_file=self.config_file, in_cluster=self.in_cluster, poll_interval=self.poll_interval, should_delete_pod=self.is_delete_operator_pod, get_logs=self.get_logs, startup_timeout=self.startup_timeout_seconds, base_container_name=self.base_container_name, ), method_name="execute_complete", )
load the config file in the triggerer instead of loading it in the worker and pass it as a dict
https://github.com/apache/airflow/commit/e7b0e39557602ae215cc8722a97ec6b43df1c3ab
null
null
airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py
0
py
false
2023-02-21T00:28:45Z
function ImageTextAlternativeEditing() { Object(_var_www_lime25_limesurvey_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ImageTextAlternativeEditing); return Object(_var_www_lime25_limesurvey_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_var_www_lime25_limesurvey_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(ImageTextAlternativeEditing).apply(this, arguments)); }
function ImageTextAlternativeEditing() { Object(_var_www_limedev_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, ImageTextAlternativeEditing); return Object(_var_www_limedev_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_2__["default"])(this, Object(_var_www_limedev_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_3__["default"])(ImageTextAlternativeEditing).apply(this, arguments)); }
DEV: changed routes in vue.js part questiongroupedit.js and deleted old controller+views
https://github.com/LimeSurvey/LimeSurvey/commit/d7a309bf1a73e95187528982b9db7ec03fee6913
CVE-2020-23710
['CWE-79']
assets/packages/questiongroup/build/js/questiongroupedit.js
0
js
false
2020-06-08T09:23:29Z
def latest_partition( cls, table_name: str, schema: Optional[str], database: Database, show_first: bool = False, ) -> Tuple[List[str], Optional[List[str]]]: """Returns col name and the latest (max) partition value for a table :param table_name: the name of the table :param schema: schema / database / namespace :param database: database query will be run against :type database: models.Database :param show_first: displays the value for the first partitioning key if there are many partitioning keys :type show_first: bool >>> latest_partition('foo_table') (['ds'], ('2018-01-01',)) """ indexes = database.get_indexes(table_name, schema) if not indexes: raise SupersetTemplateException( f"Error getting partition for {schema}.{table_name}. " "Verify that this table has a partition." ) if len(indexes[0]["column_names"]) < 1: raise SupersetTemplateException( "The table should have one partitioned field" ) if not show_first and len(indexes[0]["column_names"]) > 1: raise SupersetTemplateException( "The table should have a single partitioned field " "to use this function. You may want to use " "`presto.latest_sub_partition`" ) column_names = indexes[0]["column_names"] return column_names, cls._latest_partition_from_df( df=database.get_df( sql=cls._partition_query( table_name, schema, indexes, database, limit=1, order_by=[(column_name, True) for column_name in column_names], ), schema=schema, ) )
def latest_partition( cls, table_name: str, schema: str | None, database: Database, show_first: bool = False, ) -> tuple[list[str], list[str] | None]: """Returns col name and the latest (max) partition value for a table :param table_name: the name of the table :param schema: schema / database / namespace :param database: database query will be run against :type database: models.Database :param show_first: displays the value for the first partitioning key if there are many partitioning keys :type show_first: bool >>> latest_partition('foo_table') (['ds'], ('2018-01-01',)) """ indexes = database.get_indexes(table_name, schema) if not indexes: raise SupersetTemplateException( f"Error getting partition for {schema}.{table_name}. " "Verify that this table has a partition." ) if len(indexes[0]["column_names"]) < 1: raise SupersetTemplateException( "The table should have one partitioned field" ) if not show_first and len(indexes[0]["column_names"]) > 1: raise SupersetTemplateException( "The table should have a single partitioned field " "to use this function. You may want to use " "`presto.latest_sub_partition`" ) column_names = indexes[0]["column_names"] return column_names, cls._latest_partition_from_df( df=database.get_df( sql=cls._partition_query( table_name, schema, indexes, database, limit=1, order_by=[(column_name, True) for column_name in column_names], ), schema=schema, ) )
Merge branch 'master' into fix/db-val-param-perms
https://github.com/apache/superset/commit/4e2fd6f4f04c61e8c1d3ec3f233581a05f8b6213
null
null
superset/db_engine_specs/presto.py
0
py
false
2023-06-05T08:42:54Z
def get_ndb_model_from_beam_entity(beam_entity): """Returns an NDB model equivalent to the given Apache Beam entity. Args: beam_entity: beam_datastore_types.Entity. The Apache Beam entity. Returns: datastore_services.Model. The NDB model. """ ndb_key = get_ndb_key_from_beam_key(beam_entity.key) # We use private _lookup_model and _entity_from_ds_entity here because it # provides a functionality that we need and writing it ourselves would be # too complicated. ndb_model_class = datastore_services.Model._lookup_model(ndb_key.kind()) # pylint: disable=protected-access return ndb_model._entity_from_ds_entity( # pylint: disable=protected-access beam_entity.to_client_entity(), model_class=ndb_model_class)
def get_ndb_model_from_beam_entity( beam_entity: beam_datastore_types.Entity ) -> datastore_services.Model: """Returns an NDB model equivalent to the given Apache Beam entity. Args: beam_entity: beam_datastore_types.Entity. The Apache Beam entity. Returns: datastore_services.Model. The NDB model. """ ndb_key = get_ndb_key_from_beam_key(beam_entity.key) # We use private _lookup_model and _entity_from_ds_entity here because it # provides a functionality that we need and writing it ourselves would be # too complicated. ndb_model_class = get_model_class(ndb_key.kind()) # pylint: disable=protected-access return ndb_model._entity_from_ds_entity( # pylint: disable=protected-access beam_entity.to_client_entity(), model_class=ndb_model_class)
Merge remote-tracking branch 'upstream/develop' into secure-redirection
https://github.com/oppia/oppia/commit/11a7838e2269729b17513eca910b04951daa83ee
null
null
jobs/job_utils.py
0
py
false
2021-09-25T13:52:17Z
@Override public void onAttach(@NonNull Context context) { super.onAttach(context); // This makes sure that the container activity has implemented // the callback interfaces. If not, it throws an exception try { mToolbarAndFABCallback = (ToolbarAndFABCallback) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement ToolbarAndFABCallback"); } try { mRecentAlbumsSelectedListener = (OnRecentAlbumsSelectedListener) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement OnRecentAlbumsSelectedListener"); } }
@Override public void onAttach(@NonNull Context context) { super.onAttach(context); // This makes sure that the container activity has implemented // the callback interfaces. If not, it throws an exception try { mToolbarAndFABCallback = (ToolbarAndFABCallback) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement ToolbarAndFABCallback"); } try { mRecentAlbumsSelectedListener = (OnRecentAlbumsSelectedListener) context; } catch (ClassCastException e) { throw new ClassCastException(context.toString() + " must implement OnRecentAlbumsSelectedListener"); } if(mSearchView != null) { mSearchView.setOnQueryTextListener(new SearchTextObserver()); } }
update volley to 1.2.1
https://github.com/gateship-one/odyssey/commit/1c6c859c8805bdf1c1c488f874f6324c457fa866
null
null
app/src/main/java/org/gateshipone/odyssey/fragments/MyMusicFragment.java
0
java
false
2021-10-25T15:43:13Z
def _render_job_button_for_obj(job_button, obj, context, content_type): """ Helper method for job_buttons templatetag to reduce repetition of code. Returns: (str, str): (button_html, form_html) """ # Pass select context data when rendering the JobButton text as Jinja2 button_context = { "obj": obj, "debug": context.get("debug", False), # django.template.context_processors.debug "request": context["request"], # django.template.context_processors.request "user": context["user"], # django.contrib.auth.context_processors.auth "perms": context["perms"], # django.contrib.auth.context_processors.auth } try: text_rendered = render_jinja2(job_button.text, button_context) except Exception as exc: return ( format_html( '<a class="btn btn-sm btn-{}" disabled="disabled" title="{}"><i class="mdi mdi-alert"></i> {}</a>\n', "default" if not job_button.group_name else "link", exc, job_button.name, ), SAFE_EMPTY, ) if not text_rendered: return (SAFE_EMPTY, SAFE_EMPTY) # Disable buttons if the user doesn't have permission to run the underlying Job. has_run_perm = Job.objects.check_perms(context["user"], instance=job_button.job, action="run") hidden_inputs = format_html( HIDDEN_INPUTS, csrf_token=context["csrf_token"], object_pk=obj.pk, object_model_name=f"{content_type.app_label}.{content_type.model}", redirect_path=context["request"].path, ) template_args = { "button_id": job_button.pk, "button_text": text_rendered, "button_class": job_button.button_class if not job_button.group_name else "link", "button_url": reverse("extras:job_run", kwargs={"slug": job_button.job.slug}), "object": obj, "job": job_button.job, "hidden_inputs": hidden_inputs, "disabled": "" if has_run_perm else "disabled", } if job_button.confirmation: return ( format_html(CONFIRM_BUTTON, **template_args), format_html(CONFIRM_MODAL, **template_args), ) else: return ( format_html(NO_CONFIRM_BUTTON, **template_args), format_html(NO_CONFIRM_FORM, **template_args), )
def _render_job_button_for_obj(job_button, obj, context, content_type): """ Helper method for job_buttons templatetag to reduce repetition of code. Returns: (str, str): (button_html, form_html) """ # Pass select context data when rendering the JobButton text as Jinja2 button_context = { "obj": obj, "debug": context.get("debug", False), # django.template.context_processors.debug "request": context["request"], # django.template.context_processors.request "user": context["user"], # django.contrib.auth.context_processors.auth "perms": context["perms"], # django.contrib.auth.context_processors.auth } try: text_rendered = render_jinja2(job_button.text, button_context) except Exception as exc: return ( format_html( '<a class="btn btn-sm btn-{}" disabled="disabled" title="{}"><i class="mdi mdi-alert"></i> {}</a>\n', "default" if not job_button.group_name else "link", exc, job_button.name, ), SAFE_EMPTY_STR, ) if not text_rendered: return (SAFE_EMPTY_STR, SAFE_EMPTY_STR) # Disable buttons if the user doesn't have permission to run the underlying Job. has_run_perm = Job.objects.check_perms(context["user"], instance=job_button.job, action="run") hidden_inputs = format_html( HIDDEN_INPUTS, csrf_token=context["csrf_token"], object_pk=obj.pk, object_model_name=f"{content_type.app_label}.{content_type.model}", redirect_path=context["request"].path, ) template_args = { "button_id": job_button.pk, "button_text": text_rendered, "button_class": job_button.button_class if not job_button.group_name else "link", "button_url": reverse("extras:job_run", kwargs={"slug": job_button.job.slug}), "object": obj, "job": job_button.job, "hidden_inputs": hidden_inputs, "disabled": "" if has_run_perm else "disabled", } if job_button.confirmation: return ( format_html(CONFIRM_BUTTON, **template_args), format_html(CONFIRM_MODAL, **template_args), ) else: return ( format_html(NO_CONFIRM_BUTTON, **template_args), format_html(NO_CONFIRM_FORM, **template_args), )
s/SAFE_EMPTY/SAFE_EMPTY_STR/
https://github.com/nautobot/nautobot/commit/1d6f8b855ff3303bf76787dbbad19c1b189a2b3c
null
null
nautobot/extras/templatetags/job_buttons.py
0
py
false
null
def retry_building_docs_if_needed( all_build_errors, all_spelling_errors, args, docs_only, jobs, package_build_errors, package_spelling_errors, current_packages, spellcheck_only, ): to_retry_packages = [ package_name for package_name, errors in package_build_errors.items() if any(any((m in e.message) for m in ERRORS_ELIGIBLE_TO_REBUILD) for e in errors) ] if to_retry_packages and spellcheck_only: # in case spellchecking fails with retry all packages should be rebuilt without spell-checking # in case the failed package refers to another package to_retry_packages = current_packages if to_retry_packages: for package_name in to_retry_packages: if package_name in all_build_errors: del all_build_errors[package_name] if package_name in all_spelling_errors: del all_spelling_errors[package_name] package_build_errors, package_spelling_errors = build_docs_for_packages( current_packages=to_retry_packages, docs_only=docs_only, spellcheck_only=False, jobs=jobs, verbose=args.verbose, ) if package_build_errors: all_build_errors.update(package_build_errors) if package_spelling_errors: all_spelling_errors.update(package_spelling_errors) return package_build_errors, package_spelling_errors return package_build_errors, package_spelling_errors
def retry_building_docs_if_needed( all_build_errors: dict[str, list[DocBuildError]], all_spelling_errors: dict[str, list[SpellingError]], args: argparse.Namespace, docs_only: bool, jobs: int, package_build_errors: dict[str, list[DocBuildError]], originally_built_packages: list[str], rebuild_all_packages: bool, ) -> dict[str, list[DocBuildError]]: to_retry_packages = [ package_name for package_name, errors in package_build_errors.items() if any(any((m in e.message) for m in ERRORS_ELIGIBLE_TO_REBUILD) for e in errors) ] if not to_retry_packages: console.print("[green]No packages to retry. No more passes are needed.[/]") return package_build_errors console.print("[warning] Some packages failed to build due to dependencies. We need another pass.[/]") # if we are rebuilding all packages, we need to retry all packages # even if there is one package to rebuild only if rebuild_all_packages: console.print("[warning]Rebuilding all originally built package as this is the first build pass:[/]") to_retry_packages = originally_built_packages console.print(f"[bright_blue]Packages to rebuild: {to_retry_packages}[/]") for package_name in to_retry_packages: if package_name in all_build_errors: del all_build_errors[package_name] if package_name in all_spelling_errors: del all_spelling_errors[package_name] package_build_errors, package_spelling_errors = build_docs_for_packages( packages_to_build=to_retry_packages, docs_only=docs_only, spellcheck_only=False, jobs=jobs, verbose=args.verbose, ) if package_build_errors: all_build_errors.update(package_build_errors) if package_spelling_errors: all_spelling_errors.update(package_spelling_errors) return package_build_errors
Merge branch 'main' into trigger_encryption
https://github.com/apache/airflow/commit/bbc7408e175819eb8a2666acddd5bc48f403baf7
null
null
docs/build_docs.py
0
py
false
2024-01-08T23:50:49Z
public static int setVideoQuality(Object[] qualities, int quality, Object qInterface, String qIndexMethod) { int preferredQuality; Field[] fields; if (!ReVancedUtils.isNewVideoStarted() && !userChangedQuality || qInterface == null) { return quality; } Class<?> intType = Integer.TYPE; ArrayList<Integer> iStreamQualities = new ArrayList<>(); try { for (Object streamQuality : qualities) { for (Field field : streamQuality.getClass().getFields()) { if (field.getType().isAssignableFrom(intType)) { // converts quality index to actual readable resolution int value = field.getInt(streamQuality); if (field.getName().length() <= 2) { iStreamQualities.add(value); } } } } } catch (Exception ignored) { } Collections.sort(iStreamQualities); int index = 0; if (userChangedQuality) { for (int convertedQuality : iStreamQualities) { int selectedQuality2 = qualities.length - selectedQuality1 + 1; index++; if (selectedQuality2 == index) { LogHelper.debug(VideoQualityPatch.class, "Quality index is: " + index + " and corresponding value is: " + convertedQuality); changeDefaultQuality(convertedQuality); return selectedQuality2; } } } ReVancedUtils.setNewVideo(false); LogHelper.debug(VideoQualityPatch.class, "Quality: " + quality); Context context = ReVancedUtils.getContext(); if (context == null) { LogHelper.printException(VideoQualityPatch.class, "Context is null or settings not initialized, returning quality: " + quality); return quality; } if (isConnectedWifi(context)) { SharedPreferences wifi = context.getSharedPreferences("revanced_prefs", 0); preferredQuality = wifi.getInt("wifi_quality", -2); LogHelper.debug(VideoQualityPatch.class, "Wi-Fi connection detected, preferred quality: " + preferredQuality); } else if (isConnectedMobile(context)) { SharedPreferences mobile = context.getSharedPreferences("revanced_prefs", 0); preferredQuality = mobile.getInt("mobile_quality", -2); LogHelper.debug(VideoQualityPatch.class, "Mobile data connection detected, preferred quality: " + preferredQuality); } else { LogHelper.debug(VideoQualityPatch.class, "No Internet connection!"); return quality; } if (preferredQuality == -2) { return quality; } for (int streamQuality2 : iStreamQualities) { LogHelper.debug(VideoQualityPatch.class, "Quality at index " + index + ": " + streamQuality2); index++; } for (Integer iStreamQuality : iStreamQualities) { int streamQuality3 = iStreamQuality; if (streamQuality3 <= preferredQuality) { quality = streamQuality3; } } if (quality == -2) { return quality; } int qualityIndex = iStreamQualities.indexOf(quality); LogHelper.debug(VideoQualityPatch.class, "Index of quality " + quality + " is " + qualityIndex); try { Class<?> cl = qInterface.getClass(); Method m = cl.getMethod(qIndexMethod, Integer.TYPE); LogHelper.debug(VideoQualityPatch.class, "Method is: " + qIndexMethod); m.invoke(qInterface, iStreamQualities.get(qualityIndex)); LogHelper.debug(VideoQualityPatch.class, "Quality changed to: " + qualityIndex); return qualityIndex; } catch (Exception ex) { LogHelper.printException(VideoQualityPatch.class, "Failed to set quality", ex); return qualityIndex; } }
public static int setVideoQuality(Object[] qualities, int quality, Object qInterface, String qIndexMethod) { int preferredQuality; Field[] fields; if (!(newVideo || userChangedQuality) || qInterface == null) { return quality; } Class<?> intType = Integer.TYPE; ArrayList<Integer> iStreamQualities = new ArrayList<>(); try { for (Object streamQuality : qualities) { for (Field field : streamQuality.getClass().getFields()) { if (field.getType().isAssignableFrom(intType)) { // converts quality index to actual readable resolution int value = field.getInt(streamQuality); if (field.getName().length() <= 2) { iStreamQualities.add(value); } } } } } catch (Exception ignored) { } Collections.sort(iStreamQualities); int index = 0; if (userChangedQuality) { for (int convertedQuality : iStreamQualities) { int selectedQuality2 = qualities.length - selectedQuality1 + 1; index++; if (selectedQuality2 == index) { LogHelper.debug(VideoQualityPatch.class, "Quality index is: " + index + " and corresponding value is: " + convertedQuality); changeDefaultQuality(convertedQuality); return selectedQuality2; } } } newVideo = false; LogHelper.debug(VideoQualityPatch.class, "Quality: " + quality); Context context = ReVancedUtils.getContext(); if (context == null) { LogHelper.printException(VideoQualityPatch.class, "Context is null or settings not initialized, returning quality: " + quality); return quality; } if (isConnectedWifi(context)) { SharedPreferences wifi = context.getSharedPreferences("revanced_prefs", 0); preferredQuality = wifi.getInt("wifi_quality", -2); LogHelper.debug(VideoQualityPatch.class, "Wi-Fi connection detected, preferred quality: " + preferredQuality); } else if (isConnectedMobile(context)) { SharedPreferences mobile = context.getSharedPreferences("revanced_prefs", 0); preferredQuality = mobile.getInt("mobile_quality", -2); LogHelper.debug(VideoQualityPatch.class, "Mobile data connection detected, preferred quality: " + preferredQuality); } else { LogHelper.debug(VideoQualityPatch.class, "No Internet connection!"); return quality; } if (preferredQuality == -2) { return quality; } for (int streamQuality2 : iStreamQualities) { LogHelper.debug(VideoQualityPatch.class, "Quality at index " + index + ": " + streamQuality2); index++; } for (Integer iStreamQuality : iStreamQualities) { int streamQuality3 = iStreamQuality; if (streamQuality3 <= preferredQuality) { quality = streamQuality3; } } if (quality == -2) { return quality; } int qualityIndex = iStreamQualities.indexOf(quality); LogHelper.debug(VideoQualityPatch.class, "Index of quality " + quality + " is " + qualityIndex); try { Class<?> cl = qInterface.getClass(); Method m = cl.getMethod(qIndexMethod, Integer.TYPE); LogHelper.debug(VideoQualityPatch.class, "Method is: " + qIndexMethod); m.invoke(qInterface, iStreamQualities.get(qualityIndex)); LogHelper.debug(VideoQualityPatch.class, "Quality changed to: " + qualityIndex); return qualityIndex; } catch (Exception ex) { LogHelper.printException(VideoQualityPatch.class, "Failed to set quality", ex); return qualityIndex; } }
fix: `default-video-quality` patch crashing (#100)
https://github.com/ReVanced/revanced-integrations/commit/c6b7528eaea76cf04851f4085d6e6a48731fb2dc
null
null
app/src/main/java/app/revanced/integrations/patches/VideoQualityPatch.java
0
java
false
null
public Map<String, String> getAuthScriptAsMap() { return Map.of("auth_script", this.getAuthRefreshScript(), "refresh_interval", String.valueOf(getAuthRefreshInterval())); }
public Map<String, String> getAuthScriptAsMap() { return Map.of("auth_script", this.getAuthRefreshScript(), "auth_refresh", String.valueOf(getAuthRefreshInterval())); }
Update quarkus to latest version
https://github.com/Endava/cats/commit/0b8736cdd7403b1471e7cd5ef2f59c40e6fd026b
null
null
src/main/java/com/endava/cats/args/AuthArguments.java
0
java
false
null
def load_or_create_client_key(key_file): """Load the ACME account key from a file, creating it if it does not exist. Args: key_file (str): name of the file to use as the account key """ # this is based on txacme.endpoint.load_or_create_client_key, but doesn't # hardcode the 'client.key' filename acme_key_file = FilePath(key_file) if acme_key_file.exists(): logger.info("Loading ACME account key from '%s'", acme_key_file) key = serialization.load_pem_private_key( acme_key_file.getContent(), password=None, backend=default_backend() ) else: logger.info("Saving new ACME account key to '%s'", acme_key_file) key = generate_private_key("rsa") acme_key_file.setContent( key.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption(), ) ) return JWKRSA(key=key)
def load_or_create_client_key(key_file: str) -> JWKRSA: """Load the ACME account key from a file, creating it if it does not exist. Args: key_file: name of the file to use as the account key """ # this is based on txacme.endpoint.load_or_create_client_key, but doesn't # hardcode the 'client.key' filename acme_key_file = FilePath(key_file) if acme_key_file.exists(): logger.info("Loading ACME account key from '%s'", acme_key_file) key = serialization.load_pem_private_key( acme_key_file.getContent(), password=None, backend=default_backend() ) else: logger.info("Saving new ACME account key to '%s'", acme_key_file) key = generate_private_key("rsa") acme_key_file.setContent( key.private_bytes( encoding=serialization.Encoding.PEM, format=serialization.PrivateFormat.TraditionalOpenSSL, encryption_algorithm=serialization.NoEncryption(), ) ) return JWKRSA(key=key)
Merge remote-tracking branch 'origin/develop' into clokep/template-clean-up
https://github.com/matrix-org/synapse/commit/ba7f48a37848dcec60e99bc23ecd5e16137d2b45
null
null
synapse/handlers/acme_issuing_service.py
0
py
false
2021-01-27T13:35:31Z
function Q(){var b;return 93===a.charCodeAt(vc)?(b=hc,vc++):(b=X,0===Bc&&g(ic)),b}
function Q(){var b;return 93===a.charCodeAt(sc)?(b=ec,sc++):(b=X,0===xc&&g(fc)),b}
fix for prototype pollution vulnerability
https://github.com/linkedin/dustjs/commit/ddb6523832465d38c9d80189e9de60519ac307c3
CVE-2021-4264
['CWE-1321']
dist/dust-full.min.js
0
js
false
2021-09-08T00:12:45Z
static Image *ReadWEBPImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowWEBPException(severity,tag) \ { \ if (stream != (unsigned char *) NULL) \ stream=(unsigned char*) RelinquishMagickMemory(stream); \ if (webp_image != (WebPDecBuffer *) NULL) \ WebPFreeDecBuffer(webp_image); \ ThrowReaderException(severity,tag); \ } Image *image; int webp_status; MagickBooleanType status; register unsigned char *p; size_t length; ssize_t count, y; unsigned char header[12], *stream; WebPDecoderConfig configure; WebPDecBuffer *magick_restrict webp_image = &configure.output; WebPBitstreamFeatures *magick_restrict features = &configure.input; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } stream=(unsigned char *) NULL; webp_image=(WebPDecBuffer *) NULL; if (WebPInitDecoderConfig(&configure) == 0) ThrowReaderException(ResourceLimitError,"UnableToDecodeImageFile"); webp_image->colorspace=MODE_RGBA; count=ReadBlob(image,12,header); if (count != 12) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); status=IsWEBP(header,count); if (status == MagickFalse) ThrowWEBPException(CorruptImageError,"CorruptImage"); length=(size_t) (ReadWebPLSBWord(header+4)+8); if (length < 12) ThrowWEBPException(CorruptImageError,"CorruptImage"); if (length > GetBlobSize(image)) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); stream=(unsigned char *) AcquireQuantumMemory(length,sizeof(*stream)); if (stream == (unsigned char *) NULL) ThrowWEBPException(ResourceLimitError,"MemoryAllocationFailed"); (void) memcpy(stream,header,12); count=ReadBlob(image,length-12,stream+12); if (count != (ssize_t) (length-12)) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); webp_status=WebPGetFeatures(stream,length,features); if (webp_status == VP8_STATUS_OK) { image->columns=(size_t) features->width; image->rows=(size_t) features->height; image->depth=8; image->alpha_trait=features->has_alpha != 0 ? BlendPixelTrait : UndefinedPixelTrait; if (IsWEBPImageLossless(stream,length) != MagickFalse) image->quality=100; if (image_info->ping != MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(DestroyImageList(image)); } webp_status=WebPDecode(stream,length,&configure); } if (webp_status != VP8_STATUS_OK) switch (webp_status) { case VP8_STATUS_OUT_OF_MEMORY: { ThrowWEBPException(ResourceLimitError,"MemoryAllocationFailed"); break; } case VP8_STATUS_INVALID_PARAM: { ThrowWEBPException(CorruptImageError,"invalid parameter"); break; } case VP8_STATUS_BITSTREAM_ERROR: { ThrowWEBPException(CorruptImageError,"CorruptImage"); break; } case VP8_STATUS_UNSUPPORTED_FEATURE: { ThrowWEBPException(CoderError,"DataEncodingSchemeIsNotSupported"); break; } case VP8_STATUS_SUSPENDED: { ThrowWEBPException(CorruptImageError,"decoder suspended"); break; } case VP8_STATUS_USER_ABORT: { ThrowWEBPException(CorruptImageError,"user abort"); break; } case VP8_STATUS_NOT_ENOUGH_DATA: { ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); break; } default: ThrowWEBPException(CorruptImageError,"CorruptImage"); } p=(unsigned char *) webp_image->u.RGBA.rgba; for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *q; register ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelBlue(image,ScaleCharToQuantum(*p++),q); SetPixelAlpha(image,ScaleCharToQuantum(*p++),q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } WebPFreeDecBuffer(webp_image); stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(image); }
static Image *ReadWEBPImage(const ImageInfo *image_info, ExceptionInfo *exception) { #define ThrowWEBPException(severity,tag) \ { \ if (stream != (unsigned char *) NULL) \ stream=(unsigned char*) RelinquishMagickMemory(stream); \ if (webp_image != (WebPDecBuffer *) NULL) \ WebPFreeDecBuffer(webp_image); \ ThrowReaderException(severity,tag); \ } Image *image; int webp_status; MagickBooleanType status; register unsigned char *p; size_t length; ssize_t count, y; unsigned char header[12], *stream; WebPDecoderConfig configure; WebPDecBuffer *magick_restrict webp_image = &configure.output; WebPBitstreamFeatures *magick_restrict features = &configure.input; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } stream=(unsigned char *) NULL; if (WebPInitDecoderConfig(&configure) == 0) ThrowReaderException(ResourceLimitError,"UnableToDecodeImageFile"); webp_image->colorspace=MODE_RGBA; count=ReadBlob(image,12,header); if (count != 12) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); status=IsWEBP(header,count); if (status == MagickFalse) ThrowWEBPException(CorruptImageError,"CorruptImage"); length=(size_t) (ReadWebPLSBWord(header+4)+8); if (length < 12) ThrowWEBPException(CorruptImageError,"CorruptImage"); if (length > GetBlobSize(image)) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); stream=(unsigned char *) AcquireQuantumMemory(length,sizeof(*stream)); if (stream == (unsigned char *) NULL) ThrowWEBPException(ResourceLimitError,"MemoryAllocationFailed"); (void) memcpy(stream,header,12); count=ReadBlob(image,length-12,stream+12); if (count != (ssize_t) (length-12)) ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); webp_status=WebPGetFeatures(stream,length,features); if (webp_status == VP8_STATUS_OK) { image->columns=(size_t) features->width; image->rows=(size_t) features->height; image->depth=8; image->alpha_trait=features->has_alpha != 0 ? BlendPixelTrait : UndefinedPixelTrait; if (IsWEBPImageLossless(stream,length) != MagickFalse) image->quality=100; if (image_info->ping != MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(DestroyImageList(image)); } webp_status=WebPDecode(stream,length,&configure); } if (webp_status != VP8_STATUS_OK) switch (webp_status) { case VP8_STATUS_OUT_OF_MEMORY: { ThrowWEBPException(ResourceLimitError,"MemoryAllocationFailed"); break; } case VP8_STATUS_INVALID_PARAM: { ThrowWEBPException(CorruptImageError,"invalid parameter"); break; } case VP8_STATUS_BITSTREAM_ERROR: { ThrowWEBPException(CorruptImageError,"CorruptImage"); break; } case VP8_STATUS_UNSUPPORTED_FEATURE: { ThrowWEBPException(CoderError,"DataEncodingSchemeIsNotSupported"); break; } case VP8_STATUS_SUSPENDED: { ThrowWEBPException(CorruptImageError,"decoder suspended"); break; } case VP8_STATUS_USER_ABORT: { ThrowWEBPException(CorruptImageError,"user abort"); break; } case VP8_STATUS_NOT_ENOUGH_DATA: { ThrowWEBPException(CorruptImageError,"InsufficientImageDataInFile"); break; } default: ThrowWEBPException(CorruptImageError,"CorruptImage"); } p=(unsigned char *) webp_image->u.RGBA.rgba; for (y=0; y < (ssize_t) image->rows; y++) { register Quantum *q; register ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(image,ScaleCharToQuantum(*p++),q); SetPixelGreen(image,ScaleCharToQuantum(*p++),q); SetPixelBlue(image,ScaleCharToQuantum(*p++),q); SetPixelAlpha(image,ScaleCharToQuantum(*p++),q); q+=GetPixelChannels(image); } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } WebPFreeDecBuffer(webp_image); stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(image); }
https://github.com/ImageMagick/ImageMagick/issues/639
https://github.com/ImageMagick/ImageMagick/commit/06ccb0ccdcca8219862a05c5589329903473235f
null
null
coders/webp.c
0
c
false
null
public void showMultichoicePoiFilterDialog(final MapActivity mapActivity, final DismissListener listener) { final OsmandApplication app = getApplication(); final PoiFiltersHelper poiFilters = app.getPoiFilters(); final ContextMenuAdapter adapter = new ContextMenuAdapter(app); final List<PoiUIFilter> list = new ArrayList<>(); for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) { if (!f.isTopWikiFilter()) { addFilterToList(adapter, list, f, true); } } list.add(poiFilters.getCustomPOIFilter()); adapter.setProfileDependent(true); adapter.setNightMode(isNightMode(app)); final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(mapActivity, !isNightMode(app)); AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, getThemeRes(app))); final ListView listView = new ListView(ctx); listView.setDivider(null); listView.setClickable(true); listView.setAdapter(listAdapter); listView.setOnItemClickListener((parent, view, position, id) -> { ContextMenuItem item = listAdapter.getItem(position); if (item != null) { item.setSelected(!item.getSelected()); ItemClickListener clickListener = item.getItemClickListener(); if (clickListener != null) { clickListener.onContextMenuClick(listAdapter, position, position, item.getSelected(), null); } listAdapter.notifyDataSetChanged(); } }); builder.setView(listView) .setTitle(R.string.show_poi_over_map) .setPositiveButton(R.string.shared_string_ok, (dialog, which) -> { for (int i = 0; i < listAdapter.getCount(); i++) { ContextMenuItem item = listAdapter.getItem(i); PoiUIFilter filter = list.get(i); if (item != null && item.getSelected()) { if (filter.isStandardFilter()) { filter.removeUnsavedFilterByName(); } poiFilters.addSelectedPoiFilter(filter); } else { poiFilters.removeSelectedPoiFilter(filter); } } mapActivity.getMapView().refreshMap(); }) .setNegativeButton(R.string.shared_string_cancel, null) // TODO go to single choice dialog .setNeutralButton(" ", (dialog, which) -> showSingleChoicePoiFilterDialog(mapActivity, listener)); final AlertDialog alertDialog = builder.create(); alertDialog.setOnShowListener(dialog -> { Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL); Drawable drawable = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_singleselect); neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); neutralButton.setContentDescription(app.getString(R.string.shared_string_filters)); }); alertDialog.setOnDismissListener(dialog -> listener.dismiss()); alertDialog.show(); }
public void showMultichoicePoiFilterDialog(final MapActivity mapActivity, final DismissListener listener) { final OsmandApplication app = getApplication(); final PoiFiltersHelper poiFilters = app.getPoiFilters(); final ContextMenuAdapter adapter = new ContextMenuAdapter(app); final List<PoiUIFilter> list = new ArrayList<>(); for (PoiUIFilter f : poiFilters.getSortedPoiFilters(true)) { if (!f.isTopWikiFilter()) { addFilterToList(adapter, list, f, true); } } list.add(poiFilters.getCustomPOIFilter()); adapter.setProfileDependent(true); adapter.setNightMode(isNightMode(app)); final ArrayAdapter<ContextMenuItem> listAdapter = adapter.createListAdapter(mapActivity, !isNightMode(app)); AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(mapActivity, getThemeRes(app))); final ListView listView = new ListView(ctx); listView.setDivider(null); listView.setClickable(true); listView.setAdapter(listAdapter); listView.setOnItemClickListener((parent, view, position, id) -> { ContextMenuItem item = listAdapter.getItem(position); if (item != null) { item.setSelected(!item.getSelected()); ItemClickListener clickListener = item.getItemClickListener(); if (clickListener != null) { clickListener.onContextMenuClick(listAdapter, position, position, item.getSelected(), null); } listAdapter.notifyDataSetChanged(); } }); builder.setView(listView) .setTitle(R.string.show_poi_over_map) .setPositiveButton(R.string.shared_string_ok, (dialog, which) -> { for (int i = 0; i < listAdapter.getCount(); i++) { ContextMenuItem item = listAdapter.getItem(i); PoiUIFilter filter = list.get(i); if (item != null && item.getSelected()) { if (filter.isStandardFilter()) { filter.removeUnsavedFilterByName(); } poiFilters.addSelectedPoiFilter(filter); } else { poiFilters.removeSelectedPoiFilter(filter); } } mapActivity.getMapView().refreshMap(); }) .setNegativeButton(R.string.shared_string_cancel, null) // TODO go to single choice dialog .setNeutralButton(" ", (dialog, which) -> showSingleChoicePoiFilterDialog(mapActivity, listener)); final AlertDialog alertDialog = builder.create(); alertDialog.setOnShowListener(dialog -> { Button neutralButton = alertDialog.getButton(DialogInterface.BUTTON_NEUTRAL); Drawable drawable = app.getUIUtilities().getThemedIcon(R.drawable.ic_action_singleselect); neutralButton.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); neutralButton.setContentDescription(app.getString(R.string.shared_string_filters)); }); alertDialog.setOnDismissListener(dialog -> listener.dismiss()); alertDialog.show(); }
Fix configure map dialogs crash
https://github.com/osmandapp/OsmAnd/commit/0ae8e376ec7c31009c0aecc043629dc20ac1103e
null
null
OsmAnd/src/net/osmand/plus/views/MapLayers.java
0
java
false
null
function L(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&"__lodash_placeholder__"!==o||(n[r]="__lodash_placeholder__",i[u++]=r)}return i}
function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}
Update vendor libs
https://github.com/cockpit-hq/cockpit/commit/690016208850f2d788ebc3c67884d4c692587eb8
CVE-2023-1160
['CWE-1103']
modules/App/assets/vendor/lodash.js
0
js
false
2023-02-22T01:10:02Z
function parseAttributes(attrs) { if (Object(lodash_es__WEBPACK_IMPORTED_MODULE_29__["isPlainObject"])(attrs)) { attrs = Object(_ckeditor_ckeditor5_utils_src_objecttomap__WEBPACK_IMPORTED_MODULE_26__["default"])(attrs); } else { attrs = new Map(attrs); } var _iteratorNormalCompletion7 = true; var _didIteratorError7 = false; var _iteratorError7 = undefined; try { for (var _iterator7 = attrs[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { var _step7$value = Object(_var_www_lime25_limesurvey_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__["default"])(_step7.value, 2), key = _step7$value[0], value = _step7$value[1]; if (value === null) { attrs.delete(key); } else if (typeof value != 'string') { attrs.set(key, String(value)); } } } catch (err) { _didIteratorError7 = true; _iteratorError7 = err; } finally { try { if (!_iteratorNormalCompletion7 && _iterator7.return != null) { _iterator7.return(); } } finally { if (_didIteratorError7) { throw _iteratorError7; } } } return attrs; } // Parses inline styles and puts property - value pairs into styles map.
function parseAttributes(attrs) { if (Object(lodash_es__WEBPACK_IMPORTED_MODULE_29__["isPlainObject"])(attrs)) { attrs = Object(_ckeditor_ckeditor5_utils_src_objecttomap__WEBPACK_IMPORTED_MODULE_26__["default"])(attrs); } else { attrs = new Map(attrs); } var _iteratorNormalCompletion7 = true; var _didIteratorError7 = false; var _iteratorError7 = undefined; try { for (var _iterator7 = attrs[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { var _step7$value = Object(_var_www_limedev_assets_packages_questiongroup_node_modules_babel_runtime_corejs2_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__["default"])(_step7.value, 2), key = _step7$value[0], value = _step7$value[1]; if (value === null) { attrs.delete(key); } else if (typeof value != 'string') { attrs.set(key, String(value)); } } } catch (err) { _didIteratorError7 = true; _iteratorError7 = err; } finally { try { if (!_iteratorNormalCompletion7 && _iterator7.return != null) { _iterator7.return(); } } finally { if (_didIteratorError7) { throw _iteratorError7; } } } return attrs; } // Parses inline styles and puts property - value pairs into styles map.
DEV: changed routes in vue.js part questiongroupedit.js and deleted old controller+views
https://github.com/LimeSurvey/LimeSurvey/commit/d7a309bf1a73e95187528982b9db7ec03fee6913
CVE-2020-23710
['CWE-79']
assets/packages/questiongroup/build/js/questiongroupedit.js
0
js
false
2020-06-08T09:23:29Z
@LuaFunction public final Object[] seek(Optional<String> whence, Optional<Long> offset) throws LuaException { this.checkOpen(); return handleSeek(this.seekable, whence, offset); }
@LuaFunction public final Object[] seek( Optional<String> whence, Optional<Long> offset ) throws LuaException { checkOpen(); return handleSeek( seekable, whence, offset ); }
Make rightAlt only close menu, never open it. (#672) Fixes #669
https://github.com/cc-tweaked/cc-restitched/commit/094e0d4f33ff28462d9e4721edcb8c8d1581b410
null
null
src/main/java/dan200/computercraft/core/apis/handles/BinaryReadableHandle.java
0
java
false
2021-01-13T22:10:44Z
static int __kprobes do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { struct task_struct *tsk; struct mm_struct *mm; int fault, sig, code; if (notify_page_fault(regs, fsr)) return 0; tsk = current; mm = tsk->mm; /* * If we're in an interrupt or have no user * context, we must not take the fault.. */ if (in_atomic() || !mm) goto no_context; /* * As per x86, we may deadlock here. However, since the kernel only * validly references user space from well defined areas of the code, * we can bug out early if this is from code which shouldn't. */ if (!down_read_trylock(&mm->mmap_sem)) { if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc)) goto no_context; down_read(&mm->mmap_sem); } else { /* * The above down_read_trylock() might have succeeded in * which case, we'll have missed the might_sleep() from * down_read() */ might_sleep(); #ifdef CONFIG_DEBUG_VM if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc)) goto no_context; #endif } fault = __do_page_fault(mm, addr, fsr, tsk); up_read(&mm->mmap_sem); perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, addr); if (fault & VM_FAULT_MAJOR) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, addr); else if (fault & VM_FAULT_MINOR) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, addr); /* * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR */ if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) return 0; if (fault & VM_FAULT_OOM) { /* * We ran out of memory, call the OOM killer, and return to * userspace (which will retry the fault, or kill us if we * got oom-killed) */ pagefault_out_of_memory(); return 0; } /* * If we are in kernel mode at this point, we * have no context to handle this fault with. */ if (!user_mode(regs)) goto no_context; if (fault & VM_FAULT_SIGBUS) { /* * We had some memory, but were unable to * successfully fix up this page fault. */ sig = SIGBUS; code = BUS_ADRERR; } else { /* * Something tried to access memory that * isn't in our memory map.. */ sig = SIGSEGV; code = fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR; } __do_user_fault(tsk, addr, fsr, sig, code, regs); return 0; no_context: __do_kernel_fault(mm, addr, fsr, regs); return 0; }
static int __kprobes do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { struct task_struct *tsk; struct mm_struct *mm; int fault, sig, code; if (notify_page_fault(regs, fsr)) return 0; tsk = current; mm = tsk->mm; /* * If we're in an interrupt or have no user * context, we must not take the fault.. */ if (in_atomic() || !mm) goto no_context; /* * As per x86, we may deadlock here. However, since the kernel only * validly references user space from well defined areas of the code, * we can bug out early if this is from code which shouldn't. */ if (!down_read_trylock(&mm->mmap_sem)) { if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc)) goto no_context; down_read(&mm->mmap_sem); } else { /* * The above down_read_trylock() might have succeeded in * which case, we'll have missed the might_sleep() from * down_read() */ might_sleep(); #ifdef CONFIG_DEBUG_VM if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc)) goto no_context; #endif } fault = __do_page_fault(mm, addr, fsr, tsk); up_read(&mm->mmap_sem); perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); if (fault & VM_FAULT_MAJOR) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr); else if (fault & VM_FAULT_MINOR) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, addr); /* * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR */ if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) return 0; if (fault & VM_FAULT_OOM) { /* * We ran out of memory, call the OOM killer, and return to * userspace (which will retry the fault, or kill us if we * got oom-killed) */ pagefault_out_of_memory(); return 0; } /* * If we are in kernel mode at this point, we * have no context to handle this fault with. */ if (!user_mode(regs)) goto no_context; if (fault & VM_FAULT_SIGBUS) { /* * We had some memory, but were unable to * successfully fix up this page fault. */ sig = SIGBUS; code = BUS_ADRERR; } else { /* * Something tried to access memory that * isn't in our memory map.. */ sig = SIGSEGV; code = fault == VM_FAULT_BADACCESS ? SEGV_ACCERR : SEGV_MAPERR; } __do_user_fault(tsk, addr, fsr, sig, code, regs); return 0; no_context: __do_kernel_fault(mm, addr, fsr, regs); return 0; }
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Michael Cree <mcree@orcon.net.nz> Cc: Will Deacon <will.deacon@arm.com> Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com> Cc: Anton Blanchard <anton@samba.org> Cc: Eric B Munson <emunson@mgebm.net> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
null
null
arch/arm/mm/fault.c
0
c
false
null
static int _receive(gnrc_pktsnip_t *pkt) { /* NOTE: In receiving direction: pkt = payload, payload->next = tcp, tcp->next = nw */ uint16_t ctl = 0; uint16_t src = 0; uint16_t dst = 0; uint8_t hdr_size = 0; uint8_t syn = 0; gnrc_pktsnip_t *ip = NULL; gnrc_pktsnip_t *reset = NULL; gnrc_tcp_tcb_t *tcb = NULL; tcp_hdr_t *hdr; /* Get write access to the TCP header */ gnrc_pktsnip_t *tcp = gnrc_pktbuf_start_write(pkt); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : can't write to packet\n"); gnrc_pktbuf_release(pkt); return -EACCES; } pkt = tcp; #ifdef MODULE_GNRC_IPV6 /* Get IPv6 header, discard packet if doesn't contain an ip header */ LL_SEARCH_SCALAR(pkt, ip, type, GNRC_NETTYPE_IPV6); if (ip == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : pkt contains no IP Header\n"); gnrc_pktbuf_release(pkt); return 0; } #endif /* Get TCP header */ LL_SEARCH_SCALAR(pkt, tcp, type, GNRC_NETTYPE_TCP); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : pkt contains no TCP Header\n"); gnrc_pktbuf_release(pkt); return 0; } /* Extract control bits, src and dst ports and check if SYN is set (not SYN+ACK) */ hdr = (tcp_hdr_t *)tcp->data; ctl = byteorder_ntohs(hdr->off_ctl); src = byteorder_ntohs(hdr->src_port); dst = byteorder_ntohs(hdr->dst_port); syn = ((ctl & MSK_SYN_ACK) == MSK_SYN); /* Validate offset */ if (GET_OFFSET(ctl) < TCP_HDR_OFFSET_MIN) { DEBUG("gnrc_tcp_eventloop.c : _receive() : unexpected Offset Value\n"); gnrc_pktbuf_release(pkt); return -ERANGE; } /* Calculate TCP header size */ hdr_size = GET_OFFSET(ctl) * 4; /* Mark TCP header if it contains any payload */ if ((pkt->type == GNRC_NETTYPE_TCP) && (pkt->size != hdr_size)) { tcp = gnrc_pktbuf_mark(pkt, hdr_size, GNRC_NETTYPE_TCP); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : Header marking failed\n"); gnrc_pktbuf_release(pkt); return -ENOMSG; } pkt->type = GNRC_NETTYPE_UNDEF; } /* Validate checksum */ if (byteorder_ntohs(hdr->checksum) != _pkt_calc_csum(tcp, ip, pkt)) { DEBUG("gnrc_tcp_eventloop.c : _receive() : Invalid checksum\n"); gnrc_pktbuf_release(pkt); return -EINVAL; } /* Find TCB to for this packet */ mutex_lock(&_list_tcb_lock); tcb = _list_tcb_head; while (tcb) { #ifdef MODULE_GNRC_IPV6 /* Check if current TCB is fitting for the incomming packet */ if (ip->type == GNRC_NETTYPE_IPV6 && tcb->address_family == AF_INET6) { /* If SYN is set, a connection is listening on that port ... */ ipv6_addr_t *tmp_addr = NULL; if (syn && tcb->local_port == dst && tcb->state == FSM_STATE_LISTEN) { /* ... and local addr is unspec or pre configured */ tmp_addr = &((ipv6_hdr_t *)ip->data)->dst; if (ipv6_addr_equal((ipv6_addr_t *) tcb->local_addr, (ipv6_addr_t *) tmp_addr) || ipv6_addr_is_unspecified((ipv6_addr_t *) tcb->local_addr)) { break; } } /* If SYN is not set and the ports match ... */ if (!syn && tcb->local_port == dst && tcb->peer_port == src) { /* .. and the IPv6 addresses match */ tmp_addr = &((ipv6_hdr_t * )ip->data)->src; if (ipv6_addr_equal((ipv6_addr_t *) tcb->peer_addr, (ipv6_addr_t *) tmp_addr)) { break; } } } #else /* Supress compiler warnings if TCP is build without network layer */ (void) syn; (void) src; (void) dst; #endif tcb = tcb->next; } mutex_unlock(&_list_tcb_lock); /* Call FSM with event RCVD_PKT if a fitting TCB was found */ if (tcb != NULL) { _fsm(tcb, FSM_EVENT_RCVD_PKT, pkt, NULL, 0); } /* No fitting TCB has been found. Respond with reset */ else { DEBUG("gnrc_tcp_eventloop.c : _receive() : Can't find fitting tcb\n"); if ((ctl & MSK_RST) != MSK_RST) { _pkt_build_reset_from_pkt(&reset, pkt); gnrc_netapi_send(gnrc_tcp_pid, reset); } return -ENOTCONN; } gnrc_pktbuf_release(pkt); return 0; }
static int _receive(gnrc_pktsnip_t *pkt) { /* NOTE: In receiving direction: pkt = payload, payload->next = tcp, tcp->next = nw */ uint16_t ctl = 0; uint16_t src = 0; uint16_t dst = 0; uint8_t hdr_size = 0; uint8_t syn = 0; gnrc_pktsnip_t *ip = NULL; gnrc_pktsnip_t *reset = NULL; gnrc_tcp_tcb_t *tcb = NULL; tcp_hdr_t *hdr; /* Get write access to the TCP header */ gnrc_pktsnip_t *tcp = gnrc_pktbuf_start_write(pkt); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : can't write to packet\n"); gnrc_pktbuf_release(pkt); return -EACCES; } pkt = tcp; #ifdef MODULE_GNRC_IPV6 /* Get IPv6 header, discard packet if doesn't contain an ip header */ LL_SEARCH_SCALAR(pkt, ip, type, GNRC_NETTYPE_IPV6); if (ip == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : pkt contains no IP Header\n"); gnrc_pktbuf_release(pkt); return 0; } #endif /* Get TCP header */ LL_SEARCH_SCALAR(pkt, tcp, type, GNRC_NETTYPE_TCP); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : pkt contains no TCP Header\n"); gnrc_pktbuf_release(pkt); return 0; } /* Extract control bits, src and dst ports and check if SYN is set (not SYN+ACK) */ hdr = (tcp_hdr_t *)tcp->data; ctl = byteorder_ntohs(hdr->off_ctl); src = byteorder_ntohs(hdr->src_port); dst = byteorder_ntohs(hdr->dst_port); syn = ((ctl & MSK_SYN_ACK) == MSK_SYN); /* Validate offset */ if (GET_OFFSET(ctl) < TCP_HDR_OFFSET_MIN) { DEBUG("gnrc_tcp_eventloop.c : _receive() : unexpected Offset Value\n"); gnrc_pktbuf_release(pkt); return -ERANGE; } /* Calculate TCP header size */ hdr_size = GET_OFFSET(ctl) * 4; /* Mark TCP header if it contains any payload */ if ((pkt->type == GNRC_NETTYPE_TCP) && (pkt->size != hdr_size)) { tcp = gnrc_pktbuf_mark(pkt, hdr_size, GNRC_NETTYPE_TCP); if (tcp == NULL) { DEBUG("gnrc_tcp_eventloop.c : _receive() : Header marking failed\n"); gnrc_pktbuf_release(pkt); return -ENOMSG; } pkt->type = GNRC_NETTYPE_UNDEF; } /* Validate checksum */ if (byteorder_ntohs(hdr->checksum) != _pkt_calc_csum(tcp, ip, pkt)) { DEBUG("gnrc_tcp_eventloop.c : _receive() : Invalid checksum\n"); gnrc_pktbuf_release(pkt); return -EINVAL; } /* Find TCB to for this packet */ mutex_lock(&_list_tcb_lock); tcb = _list_tcb_head; while (tcb) { #ifdef MODULE_GNRC_IPV6 /* Check if current TCB is fitting for the incomming packet */ if (ip->type == GNRC_NETTYPE_IPV6 && tcb->address_family == AF_INET6) { /* If SYN is set, a connection is listening on that port ... */ ipv6_addr_t *tmp_addr = NULL; if (syn && tcb->local_port == dst && tcb->state == FSM_STATE_LISTEN) { /* ... and local addr is unspec or pre configured */ tmp_addr = &((ipv6_hdr_t *)ip->data)->dst; if (ipv6_addr_equal((ipv6_addr_t *) tcb->local_addr, (ipv6_addr_t *) tmp_addr) || ipv6_addr_is_unspecified((ipv6_addr_t *) tcb->local_addr)) { break; } } /* If SYN is not set and the ports match ... */ if (!syn && tcb->local_port == dst && tcb->peer_port == src) { /* .. and the IPv6 addresses match */ tmp_addr = &((ipv6_hdr_t * )ip->data)->src; if (ipv6_addr_equal((ipv6_addr_t *) tcb->peer_addr, (ipv6_addr_t *) tmp_addr)) { break; } } } #else /* Supress compiler warnings if TCP is build without network layer */ (void) syn; (void) src; (void) dst; #endif tcb = tcb->next; } mutex_unlock(&_list_tcb_lock); /* Call FSM with event RCVD_PKT if a fitting TCB was found */ if (tcb != NULL) { _fsm(tcb, FSM_EVENT_RCVD_PKT, pkt, NULL, 0); } /* No fitting TCB has been found. Respond with reset */ else { DEBUG("gnrc_tcp_eventloop.c : _receive() : Can't find fitting tcb\n"); if ((ctl & MSK_RST) != MSK_RST) { _pkt_build_reset_from_pkt(&reset, pkt); gnrc_netapi_send(gnrc_tcp_pid, reset); } gnrc_pktbuf_release(pkt); return -ENOTCONN; } gnrc_pktbuf_release(pkt); return 0; }
gnrc_tcp: Fix memory leak
https://github.com/RIOT-OS/RIOT/commit/c6df2064aff1ffb4015d4cedbaefb8850cb50aa8
null
null
sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c
0
c
false
null
def _call( self, prompt: str, stop: Optional[List[str]] = None, run_manager: Optional[CallbackManagerForLLMRun] = None, ) -> str: """Call to Modal endpoint.""" params = self.model_kwargs or {} response = requests.post( url=self.endpoint_url, headers={ "Content-Type": "application/json", }, json={"prompt": prompt, **params}, ) try: if prompt in response.json()["prompt"]: response_json = response.json() except KeyError: raise ValueError("LangChain requires 'prompt' key in response.") text = response_json["prompt"] if stop is not None: # I believe this is required since the stop tokens # are not enforced by the model parameters text = enforce_stop_tokens(text, stop) return text
def _call( self, prompt: str, stop: Optional[List[str]] = None, run_manager: Optional[CallbackManagerForLLMRun] = None, **kwargs: Any, ) -> str: """Call to Modal endpoint.""" params = self.model_kwargs or {} params = {**params, **kwargs} response = requests.post( url=self.endpoint_url, headers={ "Content-Type": "application/json", }, json={"prompt": prompt, **params}, ) try: if prompt in response.json()["prompt"]: response_json = response.json() except KeyError: raise ValueError("LangChain requires 'prompt' key in response.") text = response_json["prompt"] if stop is not None: # I believe this is required since the stop tokens # are not enforced by the model parameters text = enforce_stop_tokens(text, stop) return text
Merge remote-tracking branch 'upstream/master'
https://github.com/hwchase17/langchain/commit/e12294f00cb3c6d3afd6eaf0541dc3056029fc10
null
null
langchain/llms/modal.py
0
py
false
2023-06-21T06:45:39Z
private void ini() { set(hea); set(len); set(max); add(bg); add(cas); add(con); add(mus); add(jm1); set(jhea); set(jlen); set(jbg); set(jcas); set(jmax); set(name); set(jm0); set(jmh); add(lt); set(loop); set(lop); set(loop1); set(lop1); set(minres); set(minrest); set(cost); set(cos); con.setSelected(true); for (int i = 0; i < 4; i++) set(star[i] = new JTF()); addListeners(); abler(false); }
private void ini() { set(hea); set(len); set(max); add(bg); add(cas); add(con); add(mus); set(jhea); set(jlen); set(jbg); set(jcas); set(jmax); set(name); set(jm0); set(jmh); set(jm1); add(lt); set(loop); set(lop); set(loop1); set(lop1); set(minres); set(minrest); set(cost); set(cos); con.setSelected(true); for (int i = 0; i < 4; i++) set(star[i] = new JTF()); addListeners(); abler(false); }
Added toggle to consider/ignore traits for certain attack types
https://github.com/battlecatsultimate/BCU-java-PC/commit/732c4b5bcf529137b46b325e97235fe479e2efb6
null
null
src/main/java/page/info/edit/HeadEditTable.java
0
java
false
2021-05-03T00:32:57Z
public String executeXML(String sparqlQuery, int timeout) throws Exception { logger.info("Json " + sparqlQuery); initializeHybridStore(locationHdt); ParsedQuery parsedQuery = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, sparqlQuery, null); RepositoryConnection connection = repository.getConnection(); try { if (parsedQuery instanceof ParsedTupleQuery) { TupleQuery query = connection.prepareTupleQuery(sparqlQuery); ByteArrayOutputStream out = new ByteArrayOutputStream(); TupleQueryResultHandler writer = new SPARQLResultsXMLWriter(out); query.setMaxExecutionTime(timeout); try { query.evaluate(writer); } catch (QueryEvaluationException q) { logger.error("This exception was caught [" + q + "]"); } finally { connection.close(); } return out.toString("UTF8"); } else if (parsedQuery instanceof ParsedBooleanQuery) { BooleanQuery query = model.get(locationHdt).prepareBooleanQuery(sparqlQuery); if (query.evaluate() == true) { connection.close(); return "{ \"head\" : { } , \"boolean\" : true }"; } else { connection.close(); return "{ \"head\" : { } , \"boolean\" : false }"; } } else { System.out.println("Not knowledge-base yet: query is neither a SELECT nor an ASK"); return "Bad Request : query not supported "; } } finally { connection.close(); } }
public String executeXML(String sparqlQuery, int timeout) throws Exception { logger.info("Json " + sparqlQuery); initializeHybridStore(locationHdt); ParsedQuery parsedQuery = QueryParserUtil.parseQuery(QueryLanguage.SPARQL, sparqlQuery, null); RepositoryConnection connection = repository.getConnection(); try { if (parsedQuery instanceof ParsedTupleQuery) { TupleQuery query = connection.prepareTupleQuery(sparqlQuery); ByteArrayOutputStream out = new ByteArrayOutputStream(); TupleQueryResultHandler writer = new SPARQLResultsXMLWriter(out); query.setMaxExecutionTime(timeout); try { query.evaluate(writer); } catch (QueryEvaluationException q) { logger.error("This exception was caught [" + q + "]"); } finally { connection.close(); } return out.toString("UTF8"); } else if (parsedQuery instanceof ParsedBooleanQuery) { BooleanQuery query = connection.prepareBooleanQuery(sparqlQuery); if (query.evaluate() == true) { connection.close(); return "{ \"head\" : { } , \"boolean\" : true }"; } else { connection.close(); return "{ \"head\" : { } , \"boolean\" : false }"; } } else { System.out.println("Not knowledge-base yet: query is neither a SELECT nor an ASK"); return "Bad Request : query not supported "; } } finally { connection.close(); } }
add step crashing and start tests
https://github.com/the-qa-company/qEndpoint/commit/90451be4445b0b51472755345784c13307f2a5a1
null
null
hdt-qs-backend/src/main/java/com/the_qa_company/q_endpoint/controller/Sparql.java
0
java
false
2022-02-04T15:11:26Z
private void addCertCaToTrustStore(String alias, Map<String, String> certData) { try { File certFile = File.createTempFile("tls", "-cert"); Files.write(certFile.toPath(), Base64.getDecoder().decode(certData.get(CA_CRT))); try { File trustStoreFile = File.createTempFile("tls", "-truststore"); if (certData.containsKey(CA_STORE)) { Files.write(trustStoreFile.toPath(), Base64.getDecoder().decode(certData.get(CA_STORE))); } try { String trustStorePassword = certData.containsKey(CA_STORE_PASSWORD) ? new String(Base64.getDecoder().decode(certData.get(CA_STORE_PASSWORD)), StandardCharsets.US_ASCII) : passwordGenerator.generate(); certManager.addCertToTrustStore(certFile, alias, trustStoreFile, trustStorePassword); certData.put(CA_STORE, Base64.getEncoder().encodeToString(Files.readAllBytes(trustStoreFile.toPath()))); certData.put(CA_STORE_PASSWORD, Base64.getEncoder().encodeToString(trustStorePassword.getBytes(StandardCharsets.US_ASCII))); } finally { delete(reconciliation, trustStoreFile); } } finally { delete(reconciliation, certFile); } } catch (IOException | CertificateException | KeyStoreException | NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
private void addCertCaToTrustStore(String alias, Map<String, String> certData) { try { File certFile = Files.createTempFile("tls", "-cert").toFile(); Files.write(certFile.toPath(), Base64.getDecoder().decode(certData.get(CA_CRT))); try { File trustStoreFile = Files.createTempFile("tls", "-truststore").toFile(); if (certData.containsKey(CA_STORE)) { Files.write(trustStoreFile.toPath(), Base64.getDecoder().decode(certData.get(CA_STORE))); } try { String trustStorePassword = certData.containsKey(CA_STORE_PASSWORD) ? new String(Base64.getDecoder().decode(certData.get(CA_STORE_PASSWORD)), StandardCharsets.US_ASCII) : passwordGenerator.generate(); certManager.addCertToTrustStore(certFile, alias, trustStoreFile, trustStorePassword); certData.put(CA_STORE, Base64.getEncoder().encodeToString(Files.readAllBytes(trustStoreFile.toPath()))); certData.put(CA_STORE_PASSWORD, Base64.getEncoder().encodeToString(trustStorePassword.getBytes(StandardCharsets.US_ASCII))); } finally { delete(reconciliation, trustStoreFile); } } finally { delete(reconciliation, certFile); } } catch (IOException | CertificateException | KeyStoreException | NoSuchAlgorithmException e) { throw new RuntimeException(e); } }
Improve JavaDoc comments before moving to Java 17 (#7664) Signed-off-by: Jakub Scholz <www@scholzj.com>
https://github.com/strimzi/strimzi-kafka-operator/commit/9b53334d5d38ac5bf7cfb60ceed5bd84b989d2f3
null
null
operator-common/src/main/java/io/strimzi/operator/cluster/model/Ca.java
0
java
false
2022-11-22T23:20:42Z
public static void loadImages() { for (int i = 0; i <= 20; i++) { MANA_IMAGES.put(String.valueOf(i), FSkin.getImage(FSkinProp.valueOf("IMG_MANA_" + i), manaImageSize, manaImageSize)); } MANA_IMAGES.put("X", FSkin.getImage(FSkinProp.IMG_MANA_X, manaImageSize, manaImageSize)); MANA_IMAGES.put("Y", FSkin.getImage(FSkinProp.IMG_MANA_Y, manaImageSize, manaImageSize)); MANA_IMAGES.put("Z", FSkin.getImage(FSkinProp.IMG_MANA_Z, manaImageSize, manaImageSize)); MANA_IMAGES.put("C", FSkin.getImage(FSkinProp.IMG_MANA_COLORLESS, manaImageSize, manaImageSize)); MANA_IMAGES.put("B", FSkin.getImage(FSkinProp.IMG_MANA_B, manaImageSize, manaImageSize)); MANA_IMAGES.put("BG", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_BG, manaImageSize, manaImageSize)); MANA_IMAGES.put("BR", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_BR, manaImageSize, manaImageSize)); MANA_IMAGES.put("G", FSkin.getImage(FSkinProp.IMG_MANA_G, manaImageSize, manaImageSize)); MANA_IMAGES.put("GU", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_GU, manaImageSize, manaImageSize)); MANA_IMAGES.put("GW", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_GW, manaImageSize, manaImageSize)); MANA_IMAGES.put("R", FSkin.getImage(FSkinProp.IMG_MANA_R, manaImageSize, manaImageSize)); MANA_IMAGES.put("RG", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_RG, manaImageSize, manaImageSize)); MANA_IMAGES.put("RW", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_RW, manaImageSize, manaImageSize)); MANA_IMAGES.put("U", FSkin.getImage(FSkinProp.IMG_MANA_U, manaImageSize, manaImageSize)); MANA_IMAGES.put("UB", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_UB, manaImageSize, manaImageSize)); MANA_IMAGES.put("UR", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_UR, manaImageSize, manaImageSize)); MANA_IMAGES.put("W", FSkin.getImage(FSkinProp.IMG_MANA_W, manaImageSize, manaImageSize)); MANA_IMAGES.put("WB", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_WB, manaImageSize, manaImageSize)); MANA_IMAGES.put("WU", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_WU, manaImageSize, manaImageSize)); MANA_IMAGES.put("PW", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_W, manaImageSize, manaImageSize)); MANA_IMAGES.put("PR", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_R, manaImageSize, manaImageSize)); MANA_IMAGES.put("PU", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_U, manaImageSize, manaImageSize)); MANA_IMAGES.put("PB", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_B, manaImageSize, manaImageSize)); MANA_IMAGES.put("PG", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_G, manaImageSize, manaImageSize)); MANA_IMAGES.put("2W", FSkin.getImage(FSkinProp.IMG_MANA_2W, manaImageSize, manaImageSize)); MANA_IMAGES.put("2U", FSkin.getImage(FSkinProp.IMG_MANA_2U, manaImageSize, manaImageSize)); MANA_IMAGES.put("2R", FSkin.getImage(FSkinProp.IMG_MANA_2R, manaImageSize, manaImageSize)); MANA_IMAGES.put("2G", FSkin.getImage(FSkinProp.IMG_MANA_2G, manaImageSize, manaImageSize)); MANA_IMAGES.put("2B", FSkin.getImage(FSkinProp.IMG_MANA_2B, manaImageSize, manaImageSize)); MANA_IMAGES.put("S", FSkin.getImage(FSkinProp.IMG_MANA_SNOW, manaImageSize, manaImageSize)); MANA_IMAGES.put("T", FSkin.getImage(FSkinProp.IMG_TAP, manaImageSize, manaImageSize)); MANA_IMAGES.put("E", FSkin.getImage(FSkinProp.IMG_ENERGY, 40, 40)); MANA_IMAGES.put("EXPERIENCE", FSkin.getImage(FSkinProp.IMG_EXPERIENCE, 40, 30)); MANA_IMAGES.put("slash", FSkin.getImage(FSkinProp.IMG_SLASH, manaImageSize, manaImageSize)); MANA_IMAGES.put("attack", FSkin.getImage(FSkinProp.IMG_ATTACK, 32, 32)); MANA_IMAGES.put("defend", FSkin.getImage(FSkinProp.IMG_DEFEND, 32, 32)); MANA_IMAGES.put("summonsick", FSkin.getImage(FSkinProp.IMG_SUMMONSICK, 32, 32)); MANA_IMAGES.put("phasing", FSkin.getImage(FSkinProp.IMG_PHASING, 32, 32)); MANA_IMAGES.put("sacrifice", FSkin.getImage(FSkinProp.IMG_COSTRESERVED, 40, 40)); MANA_IMAGES.put("counters1", FSkin.getImage(FSkinProp.IMG_COUNTERS1)); MANA_IMAGES.put("counters2", FSkin.getImage(FSkinProp.IMG_COUNTERS2)); MANA_IMAGES.put("counters3", FSkin.getImage(FSkinProp.IMG_COUNTERS3)); MANA_IMAGES.put("countersMulti", FSkin.getImage(FSkinProp.IMG_COUNTERS_MULTI)); MANA_IMAGES.put("foil01", FSkin.getImage(FSkinProp.FOIL_01)); MANA_IMAGES.put("foil02", FSkin.getImage(FSkinProp.FOIL_02)); MANA_IMAGES.put("foil03", FSkin.getImage(FSkinProp.FOIL_03)); MANA_IMAGES.put("foil04", FSkin.getImage(FSkinProp.FOIL_04)); MANA_IMAGES.put("foil05", FSkin.getImage(FSkinProp.FOIL_05)); MANA_IMAGES.put("foil06", FSkin.getImage(FSkinProp.FOIL_06)); MANA_IMAGES.put("foil07", FSkin.getImage(FSkinProp.FOIL_07)); MANA_IMAGES.put("foil08", FSkin.getImage(FSkinProp.FOIL_08)); MANA_IMAGES.put("foil09", FSkin.getImage(FSkinProp.FOIL_09)); MANA_IMAGES.put("foil10", FSkin.getImage(FSkinProp.FOIL_10)); MANA_IMAGES.put("foil11", FSkin.getImage(FSkinProp.FOIL_11)); MANA_IMAGES.put("foil12", FSkin.getImage(FSkinProp.FOIL_12)); MANA_IMAGES.put("foil13", FSkin.getImage(FSkinProp.FOIL_13)); MANA_IMAGES.put("foil14", FSkin.getImage(FSkinProp.FOIL_14)); MANA_IMAGES.put("foil15", FSkin.getImage(FSkinProp.FOIL_15)); MANA_IMAGES.put("foil16", FSkin.getImage(FSkinProp.FOIL_16)); MANA_IMAGES.put("foil17", FSkin.getImage(FSkinProp.FOIL_17)); MANA_IMAGES.put("foil18", FSkin.getImage(FSkinProp.FOIL_18)); MANA_IMAGES.put("foil19", FSkin.getImage(FSkinProp.FOIL_19)); MANA_IMAGES.put("foil20", FSkin.getImage(FSkinProp.FOIL_20)); //ability icons MANA_IMAGES.put("deathtouch", FSkin.getImage(FSkinProp.IMG_ABILITY_DEATHTOUCH)); MANA_IMAGES.put("defender", FSkin.getImage(FSkinProp.IMG_ABILITY_DEFENDER)); MANA_IMAGES.put("doublestrike", FSkin.getImage(FSkinProp.IMG_ABILITY_DOUBLE_STRIKE)); MANA_IMAGES.put("firststrike", FSkin.getImage(FSkinProp.IMG_ABILITY_FIRST_STRIKE)); MANA_IMAGES.put("fear", FSkin.getImage(FSkinProp.IMG_ABILITY_FEAR)); MANA_IMAGES.put("flash", FSkin.getImage(FSkinProp.IMG_ABILITY_FLASH)); MANA_IMAGES.put("flying", FSkin.getImage(FSkinProp.IMG_ABILITY_FLYING)); MANA_IMAGES.put("hexproof", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF)); MANA_IMAGES.put("indestructible", FSkin.getImage(FSkinProp.IMG_ABILITY_INDESTRUCTIBLE)); MANA_IMAGES.put("intimidate", FSkin.getImage(FSkinProp.IMG_ABILITY_INTIMIDATE)); MANA_IMAGES.put("lifelink", FSkin.getImage(FSkinProp.IMG_ABILITY_LIFELINK)); MANA_IMAGES.put("menace", FSkin.getImage(FSkinProp.IMG_ABILITY_MENACE)); MANA_IMAGES.put("reach", FSkin.getImage(FSkinProp.IMG_ABILITY_REACH)); MANA_IMAGES.put("shroud", FSkin.getImage(FSkinProp.IMG_ABILITY_SHROUD)); MANA_IMAGES.put("trample", FSkin.getImage(FSkinProp.IMG_ABILITY_TRAMPLE)); MANA_IMAGES.put("vigilance", FSkin.getImage(FSkinProp.IMG_ABILITY_VIGILANCE)); //hexproof from MANA_IMAGES.put("hexproofR", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_R)); MANA_IMAGES.put("hexproofG", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_G)); MANA_IMAGES.put("hexproofB", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_B)); MANA_IMAGES.put("hexproofU", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_U)); MANA_IMAGES.put("hexproofW", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_W)); MANA_IMAGES.put("hexproofC", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_C)); MANA_IMAGES.put("hexproofUB", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_UB)); //token icon MANA_IMAGES.put("token", FSkin.getImage(FSkinProp.IMG_ABILITY_TOKEN)); //protection from MANA_IMAGES.put("protectAll", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_ALL)); MANA_IMAGES.put("protectB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_B)); MANA_IMAGES.put("protectBU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BU)); MANA_IMAGES.put("protectBW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BW)); MANA_IMAGES.put("protectColoredSpells", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_COLOREDSPELLS)); MANA_IMAGES.put("protectG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_G)); MANA_IMAGES.put("protectGB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GB)); MANA_IMAGES.put("protectGU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GU)); MANA_IMAGES.put("protectGW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GW)); MANA_IMAGES.put("protectGeneric", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GENERIC)); MANA_IMAGES.put("protectR", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_R)); MANA_IMAGES.put("protectRB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RB)); MANA_IMAGES.put("protectRG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RG)); MANA_IMAGES.put("protectRU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RU)); MANA_IMAGES.put("protectRW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RW)); MANA_IMAGES.put("protectU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_U)); MANA_IMAGES.put("protectUW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_UW)); MANA_IMAGES.put("protectW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_W)); }
public static void loadImages() { for (int i = 0; i <= 20; i++) { MANA_IMAGES.put(String.valueOf(i), FSkin.getImage(FSkinProp.valueOf("IMG_MANA_" + i), manaImageSize, manaImageSize)); } MANA_IMAGES.put("X", FSkin.getImage(FSkinProp.IMG_MANA_X, manaImageSize, manaImageSize)); MANA_IMAGES.put("Y", FSkin.getImage(FSkinProp.IMG_MANA_Y, manaImageSize, manaImageSize)); MANA_IMAGES.put("Z", FSkin.getImage(FSkinProp.IMG_MANA_Z, manaImageSize, manaImageSize)); MANA_IMAGES.put("C", FSkin.getImage(FSkinProp.IMG_MANA_COLORLESS, manaImageSize, manaImageSize)); MANA_IMAGES.put("B", FSkin.getImage(FSkinProp.IMG_MANA_B, manaImageSize, manaImageSize)); MANA_IMAGES.put("BG", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_BG, manaImageSize, manaImageSize)); MANA_IMAGES.put("BR", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_BR, manaImageSize, manaImageSize)); MANA_IMAGES.put("G", FSkin.getImage(FSkinProp.IMG_MANA_G, manaImageSize, manaImageSize)); MANA_IMAGES.put("GU", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_GU, manaImageSize, manaImageSize)); MANA_IMAGES.put("GW", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_GW, manaImageSize, manaImageSize)); MANA_IMAGES.put("R", FSkin.getImage(FSkinProp.IMG_MANA_R, manaImageSize, manaImageSize)); MANA_IMAGES.put("RG", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_RG, manaImageSize, manaImageSize)); MANA_IMAGES.put("RW", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_RW, manaImageSize, manaImageSize)); MANA_IMAGES.put("U", FSkin.getImage(FSkinProp.IMG_MANA_U, manaImageSize, manaImageSize)); MANA_IMAGES.put("UB", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_UB, manaImageSize, manaImageSize)); MANA_IMAGES.put("UR", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_UR, manaImageSize, manaImageSize)); MANA_IMAGES.put("W", FSkin.getImage(FSkinProp.IMG_MANA_W, manaImageSize, manaImageSize)); MANA_IMAGES.put("WB", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_WB, manaImageSize, manaImageSize)); MANA_IMAGES.put("WU", FSkin.getImage(FSkinProp.IMG_MANA_HYBRID_WU, manaImageSize, manaImageSize)); MANA_IMAGES.put("PW", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_W, manaImageSize, manaImageSize)); MANA_IMAGES.put("PR", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_R, manaImageSize, manaImageSize)); MANA_IMAGES.put("PU", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_U, manaImageSize, manaImageSize)); MANA_IMAGES.put("PB", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_B, manaImageSize, manaImageSize)); MANA_IMAGES.put("PG", FSkin.getImage(FSkinProp.IMG_MANA_PHRYX_G, manaImageSize, manaImageSize)); MANA_IMAGES.put("2W", FSkin.getImage(FSkinProp.IMG_MANA_2W, manaImageSize, manaImageSize)); MANA_IMAGES.put("2U", FSkin.getImage(FSkinProp.IMG_MANA_2U, manaImageSize, manaImageSize)); MANA_IMAGES.put("2R", FSkin.getImage(FSkinProp.IMG_MANA_2R, manaImageSize, manaImageSize)); MANA_IMAGES.put("2G", FSkin.getImage(FSkinProp.IMG_MANA_2G, manaImageSize, manaImageSize)); MANA_IMAGES.put("2B", FSkin.getImage(FSkinProp.IMG_MANA_2B, manaImageSize, manaImageSize)); MANA_IMAGES.put("S", FSkin.getImage(FSkinProp.IMG_MANA_SNOW, manaImageSize, manaImageSize)); MANA_IMAGES.put("T", FSkin.getImage(FSkinProp.IMG_TAP, manaImageSize, manaImageSize)); MANA_IMAGES.put("E", FSkin.getImage(FSkinProp.IMG_ENERGY, 40, 40)); MANA_IMAGES.put("EXPERIENCE", FSkin.getImage(FSkinProp.IMG_EXPERIENCE, 40, 30)); MANA_IMAGES.put("slash", FSkin.getImage(FSkinProp.IMG_SLASH, manaImageSize, manaImageSize)); MANA_IMAGES.put("attack", FSkin.getImage(FSkinProp.IMG_ATTACK, 32, 32)); MANA_IMAGES.put("defend", FSkin.getImage(FSkinProp.IMG_DEFEND, 32, 32)); MANA_IMAGES.put("summonsick", FSkin.getImage(FSkinProp.IMG_SUMMONSICK, 32, 32)); MANA_IMAGES.put("phasing", FSkin.getImage(FSkinProp.IMG_PHASING, 32, 32)); MANA_IMAGES.put("sacrifice", FSkin.getImage(FSkinProp.IMG_COSTRESERVED, 40, 40)); MANA_IMAGES.put("counters1", FSkin.getImage(FSkinProp.IMG_COUNTERS1)); MANA_IMAGES.put("counters2", FSkin.getImage(FSkinProp.IMG_COUNTERS2)); MANA_IMAGES.put("counters3", FSkin.getImage(FSkinProp.IMG_COUNTERS3)); MANA_IMAGES.put("countersMulti", FSkin.getImage(FSkinProp.IMG_COUNTERS_MULTI)); MANA_IMAGES.put("foil01", FSkin.getImage(FSkinProp.FOIL_01)); MANA_IMAGES.put("foil02", FSkin.getImage(FSkinProp.FOIL_02)); MANA_IMAGES.put("foil03", FSkin.getImage(FSkinProp.FOIL_03)); MANA_IMAGES.put("foil04", FSkin.getImage(FSkinProp.FOIL_04)); MANA_IMAGES.put("foil05", FSkin.getImage(FSkinProp.FOIL_05)); MANA_IMAGES.put("foil06", FSkin.getImage(FSkinProp.FOIL_06)); MANA_IMAGES.put("foil07", FSkin.getImage(FSkinProp.FOIL_07)); MANA_IMAGES.put("foil08", FSkin.getImage(FSkinProp.FOIL_08)); MANA_IMAGES.put("foil09", FSkin.getImage(FSkinProp.FOIL_09)); MANA_IMAGES.put("foil10", FSkin.getImage(FSkinProp.FOIL_10)); MANA_IMAGES.put("foil11", FSkin.getImage(FSkinProp.FOIL_11)); MANA_IMAGES.put("foil12", FSkin.getImage(FSkinProp.FOIL_12)); MANA_IMAGES.put("foil13", FSkin.getImage(FSkinProp.FOIL_13)); MANA_IMAGES.put("foil14", FSkin.getImage(FSkinProp.FOIL_14)); MANA_IMAGES.put("foil15", FSkin.getImage(FSkinProp.FOIL_15)); MANA_IMAGES.put("foil16", FSkin.getImage(FSkinProp.FOIL_16)); MANA_IMAGES.put("foil17", FSkin.getImage(FSkinProp.FOIL_17)); MANA_IMAGES.put("foil18", FSkin.getImage(FSkinProp.FOIL_18)); MANA_IMAGES.put("foil19", FSkin.getImage(FSkinProp.FOIL_19)); MANA_IMAGES.put("foil20", FSkin.getImage(FSkinProp.FOIL_20)); //ability icons MANA_IMAGES.put("deathtouch", FSkin.getImage(FSkinProp.IMG_ABILITY_DEATHTOUCH)); MANA_IMAGES.put("defender", FSkin.getImage(FSkinProp.IMG_ABILITY_DEFENDER)); MANA_IMAGES.put("doublestrike", FSkin.getImage(FSkinProp.IMG_ABILITY_DOUBLE_STRIKE)); MANA_IMAGES.put("firststrike", FSkin.getImage(FSkinProp.IMG_ABILITY_FIRST_STRIKE)); MANA_IMAGES.put("fear", FSkin.getImage(FSkinProp.IMG_ABILITY_FEAR)); MANA_IMAGES.put("flash", FSkin.getImage(FSkinProp.IMG_ABILITY_FLASH)); MANA_IMAGES.put("flying", FSkin.getImage(FSkinProp.IMG_ABILITY_FLYING)); MANA_IMAGES.put("haste", FSkin.getImage(FSkinProp.IMG_ABILITY_HASTE)); MANA_IMAGES.put("hexproof", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF)); MANA_IMAGES.put("indestructible", FSkin.getImage(FSkinProp.IMG_ABILITY_INDESTRUCTIBLE)); MANA_IMAGES.put("intimidate", FSkin.getImage(FSkinProp.IMG_ABILITY_INTIMIDATE)); MANA_IMAGES.put("lifelink", FSkin.getImage(FSkinProp.IMG_ABILITY_LIFELINK)); MANA_IMAGES.put("menace", FSkin.getImage(FSkinProp.IMG_ABILITY_MENACE)); MANA_IMAGES.put("reach", FSkin.getImage(FSkinProp.IMG_ABILITY_REACH)); MANA_IMAGES.put("shroud", FSkin.getImage(FSkinProp.IMG_ABILITY_SHROUD)); MANA_IMAGES.put("trample", FSkin.getImage(FSkinProp.IMG_ABILITY_TRAMPLE)); MANA_IMAGES.put("vigilance", FSkin.getImage(FSkinProp.IMG_ABILITY_VIGILANCE)); //hexproof from MANA_IMAGES.put("hexproofR", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_R)); MANA_IMAGES.put("hexproofG", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_G)); MANA_IMAGES.put("hexproofB", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_B)); MANA_IMAGES.put("hexproofU", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_U)); MANA_IMAGES.put("hexproofW", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_W)); MANA_IMAGES.put("hexproofC", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_C)); MANA_IMAGES.put("hexproofUB", FSkin.getImage(FSkinProp.IMG_ABILITY_HEXPROOF_UB)); //token icon MANA_IMAGES.put("token", FSkin.getImage(FSkinProp.IMG_ABILITY_TOKEN)); //protection from MANA_IMAGES.put("protectAll", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_ALL)); MANA_IMAGES.put("protectB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_B)); MANA_IMAGES.put("protectBU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BU)); MANA_IMAGES.put("protectBW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_BW)); MANA_IMAGES.put("protectColoredSpells", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_COLOREDSPELLS)); MANA_IMAGES.put("protectG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_G)); MANA_IMAGES.put("protectGB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GB)); MANA_IMAGES.put("protectGU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GU)); MANA_IMAGES.put("protectGW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GW)); MANA_IMAGES.put("protectGeneric", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_GENERIC)); MANA_IMAGES.put("protectR", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_R)); MANA_IMAGES.put("protectRB", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RB)); MANA_IMAGES.put("protectRG", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RG)); MANA_IMAGES.put("protectRU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RU)); MANA_IMAGES.put("protectRW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_RW)); MANA_IMAGES.put("protectU", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_U)); MANA_IMAGES.put("protectUW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_UW)); MANA_IMAGES.put("protectW", FSkin.getImage(FSkinProp.IMG_ABILITY_PROTECT_W)); }
- Fix auto mana payment for Chromatic Orrery and friends - Fix the Haste icon crashing in desktop Forge
https://github.com/Card-Forge/forge/commit/71f191e71b1d3108ba6bd001fbc84c115ec16195
null
null
forge-gui-desktop/src/main/java/forge/toolbox/CardFaceSymbols.java
0
java
false
null
def del_version(request, client_id, project, version): if request.method == 'GET': client = Client.objects.get(id=client_id) try: scrapyd = get_scrapyd(client) result = scrapyd.delete_version(project=project, version=version) return JsonResponse(result) except ConnectionError: return JsonResponse({'message': 'Connect Error'})
def del_version(request, client_id, project, version): if request.method == 'GET': client = Client.objects.get(id=client_id) scrapyd = get_scrapyd(client) result = scrapyd.delete_version(project=project, version=version) return JsonResponse(result)
to b1
https://github.com/Gerapy/Gerapy/commit/e8446605eb2424717418eae199ec7aad573da2d2
null
null
gerapy/server/core/views.py
0
py
false
2020-07-06T14:57:10Z
private static void initialize() { if (!dbManagerReady.get()) { synchronized (dbManagerReady) { if (!dbManagerReady.get()) { LOGGER.info("DatabaseManager starting initialization"); long start = System.currentTimeMillis(); register(new H2Manager()); register(new SqlServerManager()); register(new SnowflakeManager()); register(new BigQueryManager()); register(new DatabricksManager()); register(new PostgresManager()); register(new RedshiftManager()); MutableList<ConnectionExtension> extensions = Iterate.addAllTo(ServiceLoader.load(ConnectionExtension.class), Lists.mutable.empty()); extensions.flatCollect(ConnectionExtension::getAdditionalDatabaseManager).forEach(DatabaseManager::register); dbManagerReady.getAndSet(true); LOGGER.info("DatabaseManager initialisation took {}", System.currentTimeMillis() - start); } } } }
private static void initialize() { if (!dbManagerReady.get()) { synchronized (dbManagerReady) { if (!dbManagerReady.get()) { LOGGER.info("DatabaseManager starting initialization"); long start = System.currentTimeMillis(); register(new H2Manager()); register(new SnowflakeManager()); register(new BigQueryManager()); register(new DatabricksManager()); register(new PostgresManager()); register(new RedshiftManager()); MutableList<ConnectionExtension> extensions = Iterate.addAllTo(ServiceLoader.load(ConnectionExtension.class), Lists.mutable.empty()); extensions.flatCollect(ConnectionExtension::getAdditionalDatabaseManager).forEach(DatabaseManager::register); dbManagerReady.getAndSet(true); LOGGER.info("DatabaseManager initialisation took {}", System.currentTimeMillis() - start); } } } }
Add protocol v1_24_0 (#847) * Add protocol v1_24_0 * Update PureClientVersions to use v1_24_0
https://github.com/finos/legend-engine/commit/b00cd1bc8085c5d6c778827bca59174c70eaf06c
null
null
legend-engine-xt-relationalStore-executionPlan-connection/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/connection/driver/DatabaseManager.java
0
java
false
null
function D(qa,O,X){if(X||q!=document.activeElement&&y!=document.activeElement){qa=!1;for(O=0;O<C.length;O++)X=C[O],da?"custom"==X.key&&(d.value=X.key,da=!1):null!=X.format&&("a4"==X.key?826==k.width?(k=mxRectangle.fromRectangle(k),k.width=827):826==k.height&&(k=mxRectangle.fromRectangle(k),k.height=827):"a5"==X.key&&(584==k.width?(k=mxRectangle.fromRectangle(k),k.width=583):584==k.height&&(k=mxRectangle.fromRectangle(k),k.height=583)),k.width== X.format.width&&k.height==X.format.height?(d.value=X.key,t.setAttribute("checked","checked"),t.defaultChecked=!0,t.checked=!0,E.removeAttribute("checked"),E.defaultChecked=!1,E.checked=!1,qa=!0):k.width==X.format.height&&k.height==X.format.width&&(d.value=X.key,t.removeAttribute("checked"),t.defaultChecked=!1,t.checked=!1,E.setAttribute("checked","checked"),E.defaultChecked=!0,qa=E.checked=!0));qa?(f.style.display="",l.style.display="none"):(q.value=k.width/100,y.value=k.height/100,t.setAttribute("checked", "checked"),d.value="custom",f.style.display="none",l.style.display="")}}
function D(qa,O,X){if(X||q!=document.activeElement&&y!=document.activeElement){qa=!1;for(O=0;O<C.length;O++)X=C[O],da?"custom"==X.key&&(d.value=X.key,da=!1):null!=X.format&&("a4"==X.key?826==k.width?(k=mxRectangle.fromRectangle(k),k.width=827):826==k.height&&(k=mxRectangle.fromRectangle(k),k.height=827):"a5"==X.key&&(584==k.width?(k=mxRectangle.fromRectangle(k),k.width=583):584==k.height&&(k=mxRectangle.fromRectangle(k),k.height=583)),k.width== X.format.width&&k.height==X.format.height?(d.value=X.key,t.setAttribute("checked","checked"),t.defaultChecked=!0,t.checked=!0,E.removeAttribute("checked"),E.defaultChecked=!1,E.checked=!1,qa=!0):k.width==X.format.height&&k.height==X.format.width&&(d.value=X.key,t.removeAttribute("checked"),t.defaultChecked=!1,t.checked=!1,E.setAttribute("checked","checked"),E.defaultChecked=!0,qa=E.checked=!0));qa?(f.style.display="",m.style.display="none"):(q.value=k.width/100,y.value=k.height/100,t.setAttribute("checked", "checked"),d.value="custom",f.style.display="none",m.style.display="")}}
18.1.3 release
https://github.com/jgraph/drawio/commit/064729fec4262f9373d9fdcafda0be47cd18dd50
CVE-2023-3398
['CWE-400']
src/main/webapp/js/viewer-static.min.js
0
js
false
null
public boolean canPlayerModify(Player player) { return mainNode.isReady() && mainNode.getGrid().getSecurityService().hasPermission(player, SecurityPermissions.BUILD); }
public boolean canPlayerModify(Player player) { //TODO add check return mainNode.isReady() && mainNode.getGrid().getSecurityService().hasPermission(player, SecurityPermissions.BUILD); }
update removal
https://github.com/Team-EnderIO/EnderIO/commit/4e6a733589c3a8033e33ead854dca6b4d3e3947d
null
null
src/conduits/java/com/enderio/conduits/common/integrations/ae2/AE2InWorldConduitNodeHost.java
0
java
false
2022-10-18T14:55:12Z
public JFrame render() { final Colormap colormap = displaySettings.getColormap(); // X label final String xAxisLabel = xFeature + " (" + TMUtils.getUnitsFor( xDimension, model.getSpaceUnits(), model.getTimeUnits() ) + ")"; // Find how many different dimensions final Set< Dimension > dimensions = getUniqueValues( yFeatures, yDimensions ); // Generate one panel per different dimension final ArrayList< ExportableChartPanel > chartPanels = new ArrayList<>( dimensions.size() ); for ( final Dimension dimension : dimensions ) { // Y label final String yAxisLabel = TMUtils.getUnitsFor( dimension, model.getSpaceUnits(), model.getTimeUnits() ); // Collect suitable feature for this dimension final List< String > featuresThisDimension = getCommonKeys( dimension, yFeatures, yDimensions ); // Title final String title = buildPlotTitle( featuresThisDimension, featureNames ); // Data-set for points (easy) final XYSeriesCollection pointDataset = buildMainDataSet( featuresThisDimension ); // Point renderer final XYLineAndShapeRenderer pointRenderer = new XYLineAndShapeRenderer( false, true ); // Edge renderer final XYEdgeRenderer edgeRenderer = new XYEdgeRenderer(); // Data-set for edges final XYEdgeSeriesCollection edgeDataset = buildConnectionDataSet( featuresThisDimension ); // The chart final JFreeChart chart = ChartFactory.createXYLineChart( title, xAxisLabel, yAxisLabel, pointDataset, PlotOrientation.VERTICAL, true, true, false ); chart.getTitle().setFont( FONT ); chart.getLegend().setItemFont( SMALL_FONT ); chart.setBackgroundPaint( bgColor ); chart.setBorderVisible( false ); chart.getLegend().setBackgroundPaint( bgColor ); // The plot final XYPlot plot = chart.getXYPlot(); if ( edgeDataset != null ) { plot.setDataset( 1, edgeDataset ); plot.setRenderer( 1, edgeRenderer ); } plot.setRenderer( 0, pointRenderer ); plot.getRangeAxis().setLabelFont( FONT ); plot.getRangeAxis().setTickLabelFont( SMALL_FONT ); plot.getDomainAxis().setLabelFont( FONT ); plot.getDomainAxis().setTickLabelFont( SMALL_FONT ); plot.setOutlineVisible( false ); plot.setDomainCrosshairVisible( false ); plot.setDomainGridlinesVisible( false ); plot.setRangeCrosshairVisible( false ); plot.setRangeGridlinesVisible( false ); plot.setBackgroundAlpha( 0f ); // Plot range. ( ( NumberAxis ) plot.getRangeAxis() ).setAutoRangeIncludesZero( false ); // Ticks. Fewer of them. plot.getRangeAxis().setTickLabelInsets( new RectangleInsets( 20, 10, 20, 10 ) ); plot.getDomainAxis().setTickLabelInsets( new RectangleInsets( 10, 20, 10, 20 ) ); // Paint // pointRenderer.setUseOutlinePaint( true ); if ( edgeDataset != null ) { final int nseries = edgeDataset.getSeriesCount(); for ( int i = 0; i < nseries; i++ ) { // pointRenderer.setSeriesOutlinePaint( i, Color.black ); pointRenderer.setSeriesLinesVisible( i, false ); pointRenderer.setSeriesShape( i, DEFAULT_SHAPE, false ); pointRenderer.setSeriesPaint( i, colormap.getPaint( ( double ) i / nseries ), false ); edgeRenderer.setSeriesPaint( i, colormap.getPaint( ( double ) i / nseries ), false ); } } // The panel final ExportableChartPanel chartPanel = new ExportableChartPanel( chart ); chartPanel.setPreferredSize( new java.awt.Dimension( 500, 270 ) ); chartPanels.add( chartPanel ); } return renderCharts( chartPanels ); }
public JFrame render() { // X label final String xAxisLabel = xFeature + " (" + TMUtils.getUnitsFor( xDimension, spaceUnits, timeUnits ) + ")"; // Find how many different dimensions final Set< Dimension > dimensions = getUniqueValues( yFeatures, yDimensions ); // Generate one panel per different dimension final ArrayList< ExportableChartPanel > chartPanels = new ArrayList<>( dimensions.size() ); for ( final Dimension dimension : dimensions ) { // Y label final String yAxisLabel = TMUtils.getUnitsFor( dimension, spaceUnits, timeUnits ); // Collect suitable feature for this dimension final List< String > featuresThisDimension = getCommonKeys( dimension, yFeatures, yDimensions ); // Title final String title = buildPlotTitle( featuresThisDimension, featureNames ); // Dataset. final ModelDataset dataset = buildMainDataSet( featuresThisDimension ); final XYItemRenderer renderer = dataset.getRenderer(); // The chart final JFreeChart chart = ChartFactory.createXYLineChart( title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false ); chart.getTitle().setFont( FONT ); chart.getLegend().setItemFont( SMALL_FONT ); chart.setBackgroundPaint( bgColor ); chart.setBorderVisible( false ); chart.getLegend().setBackgroundPaint( bgColor ); // The plot final XYPlot plot = chart.getXYPlot(); plot.setRenderer( renderer ); plot.getRangeAxis().setLabelFont( FONT ); plot.getRangeAxis().setTickLabelFont( SMALL_FONT ); plot.getDomainAxis().setLabelFont( FONT ); plot.getDomainAxis().setTickLabelFont( SMALL_FONT ); plot.setOutlineVisible( false ); plot.setDomainCrosshairVisible( false ); plot.setDomainGridlinesVisible( false ); plot.setRangeCrosshairVisible( false ); plot.setRangeGridlinesVisible( false ); plot.setBackgroundAlpha( 0f ); // Plot range. ( ( NumberAxis ) plot.getRangeAxis() ).setAutoRangeIncludesZero( false ); // Ticks. Fewer of them. plot.getRangeAxis().setTickLabelInsets( new RectangleInsets( 20, 10, 20, 10 ) ); plot.getDomainAxis().setTickLabelInsets( new RectangleInsets( 10, 20, 10, 20 ) ); // The panel final ExportableChartPanel chartPanel = new ExportableChartPanel( chart ); chartPanel.setPreferredSize( new java.awt.Dimension( 500, 270 ) ); chartPanels.add( chartPanel ); } return renderCharts( chartPanels ); }
Use the new spot dataset in the grapher. Required to change Set -> List to the collection of objects to plot and the set of features to plot.
https://github.com/trackmate-sc/TrackMate/commit/c15faf6268865e90b1da8be72bbeeab0605153ec
null
null
src/main/java/fiji/plugin/trackmate/features/AbstractFeatureGrapher.java
0
java
false
null
public void writeString(@NotNull String string) { this.ensureWriting(); byte[] stringBytes = string.getBytes(CHARSET_UTF_8); this.writeByteArray(stringBytes); }
public void writeString(@NotNull String string) { this.ensureWriting(); byte[] stringBytes = string.getBytes(StandardCharsets.UTF_8); this.writeByteArray(stringBytes); }
Fix Bukkit not sending handshake response/crashing client
https://github.com/2008Choco/VeinMiner/commit/2984ce29813e6145245466c2f7d13bf82903489e
null
null
VeinMiner-Common/src/main/java/wtf/choco/veinminer/network/PluginMessageByteBuffer.java
0
java
false
2022-01-28T22:30:43Z
public void addTrait(BeeTrait trait){ if (trait != null) { if (trait.hasDamagePotionEffects()) { this.potionDamageEffects.addAll(trait.getPotionDamageEffects()); } if (trait.hasDamageImmunities()) { this.damageImmunities.addAll(trait.getDamageImmunities()); } if (trait.hasPotionImmunities()) { this.potionImmunities.addAll(trait.getPotionImmunities()); } if (trait.hasDamageTypes()) { this.damageTypes.addAll(trait.getDamageTypes()); } if (trait.hasSpecialAbilities()) { this.specialAbilities.addAll(trait.getSpecialAbilities()); } if (trait.hasParticleEffect()) { this.particleEffects.add(trait.getParticleEffect()); } } }
public void addTrait(BeeTrait trait){ if (trait != null) { if (trait.hasDamagePotionEffects()) { this.potionDamageEffects.addAll(trait.getPotionDamageEffects()); } if (trait.hasDamageImmunities()) { this.damageImmunities.addAll(trait.getDamageImmunities()); } if (trait.hasPotionImmunities()) { this.potionImmunities.addAll(trait.getPotionImmunities()); } if (trait.hasDamageTypes()) { this.damageTypes.addAll(trait.getDamageTypes()); } if (trait.hasSpecialAbilities()) { this.specialAbilities.addAll(trait.getSpecialAbilities()); } if (trait.hasParticleEffect()) { this.particleEffects.add(trait.getParticleEffect()); } if (trait.hasBeeAuras()) { this.beeAuras.addAll(trait.getAuras()); } } }
Added initial aura code bees can now also do other damage types with traits the amplifier will determine how much damage each trait damage type will deal the default sting attack will still also occur
https://github.com/Team-Resourceful/ResourcefulBees/commit/8aa5c6ce0ca209025f5a27685fb08d86bf76398f
null
null
src/main/java/com/resourcefulbees/resourcefulbees/api/beedata/TraitData.java
0
java
false
null
def get_stacktrace() -> Optional[str]: if current_app.config["SHOW_STACKTRACE"]: return traceback.format_exc() return None
def get_stacktrace() -> str | None: if current_app.config["SHOW_STACKTRACE"]: return traceback.format_exc() return None
Merge branch 'master' into fix/db-val-param-perms
https://github.com/apache/superset/commit/4e2fd6f4f04c61e8c1d3ec3f233581a05f8b6213
null
null
superset/utils/core.py
0
py
false
2023-06-05T08:42:54Z
public void aiStep() { super.aiStep(); if (this.getAttackTimer() > 0) { this.entityData.set(ATTACK_TIMER, this.getAttackTimer() - 1); } if (this.getRockTimer() > 0) { this.entityData.set(ROCK_TIMER, this.getRockTimer() - 1); } }
public void aiStep() { super.aiStep(); if (this.getRockTimer() == 5) { this.throwRocks(); } if (this.getAttackTimer() > 0) { this.entityData.set(ATTACK_TIMER, this.getAttackTimer() - 1); } if (this.getRockTimer() > 0) { this.entityData.set(ROCK_TIMER, this.getRockTimer() - 1); } }
Finished Dwarf throw attack and added Dwarf sounds
https://github.com/infernalstudios/Infernal-Expansion/commit/652ce735930a0b2db7131eeb881dc997cf07a860
null
null
src/main/java/org/infernalstudios/infernalexp/entities/BlackstoneDwarfEntity.java
0
java
false
null
def _find_working_git(self): test_cmd = 'version' if app.GIT_PATH: main_git = '"' + app.GIT_PATH + '"' else: main_git = 'git' log.debug(u'Checking if we can use git commands: {0} {1}', main_git, test_cmd) _, _, exit_status = self._run_git(main_git, test_cmd) if exit_status == 0: log.debug(u'Using: {0}', main_git) return main_git else: log.debug(u'Not using: {0}', main_git) # trying alternatives alternative_git = [] # osx people who start sr from launchd have a broken path, so try a hail-mary attempt for them if platform.system().lower() == 'darwin': alternative_git.append('/usr/local/git/bin/git') if platform.system().lower() == 'windows': if main_git != main_git.lower(): alternative_git.append(main_git.lower()) if alternative_git: log.debug(u'Trying known alternative git locations') for cur_git in alternative_git: log.debug(u'Checking if we can use git commands: {0} {1}', cur_git, test_cmd) _, _, exit_status = self._run_git(cur_git, test_cmd) if exit_status == 0: log.debug(u'Using: {0}', cur_git) return cur_git else: log.debug(u'Not using: {0}', cur_git)
def _find_working_git(self): test_cmd = 'version' main_git = app.GIT_PATH or 'git' log.debug(u'Checking if we can use git commands: {0} {1}', main_git, test_cmd) _, _, exit_status = self._run_git(main_git, test_cmd) if exit_status == 0: log.debug(u'Using: {0}', main_git) return main_git else: log.debug(u'Not using: {0}', main_git) # trying alternatives alternative_git = [] # osx people who start sr from launchd have a broken path, so try a hail-mary attempt for them if platform.system().lower() == 'darwin': alternative_git.append('/usr/local/git/bin/git') if platform.system().lower() == 'windows': if main_git != main_git.lower(): alternative_git.append(main_git.lower()) if alternative_git: log.debug(u'Trying known alternative git locations') for cur_git in alternative_git: log.debug(u'Checking if we can use git commands: {0} {1}', cur_git, test_cmd) _, _, exit_status = self._run_git(cur_git, test_cmd) if exit_status == 0: log.debug(u'Using: {0}', cur_git) return cur_git else: log.debug(u'Not using: {0}', cur_git)
Ensure that git_path is a valid file (#11138) * Ensure that git_path is a valid file * Update github_updater.py
https://github.com/pymedusa/Medusa/commit/66d4be8f0872bd5ddcdc5c5a58cb014d22834a45
null
null
medusa/updater/github_updater.py
0
py
false
2023-02-22T10:23:45Z
static expr_ty ast_for_atom(struct compiling *c, const node *n) { /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictmaker|testlist_comp] '}' | NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' */ node *ch = CHILD(n, 0); switch (TYPE(ch)) { case NAME: { PyObject *name; const char *s = STR(ch); size_t len = strlen(s); if (len >= 4 && len <= 5) { if (!strcmp(s, "None")) return NameConstant(Py_None, LINENO(n), n->n_col_offset, c->c_arena); if (!strcmp(s, "True")) return NameConstant(Py_True, LINENO(n), n->n_col_offset, c->c_arena); if (!strcmp(s, "False")) return NameConstant(Py_False, LINENO(n), n->n_col_offset, c->c_arena); } name = new_identifier(s, c); if (!name) return NULL; /* All names start in Load context, but may later be changed. */ return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); } case STRING: { expr_ty str = parsestrplus(c, n); if (!str) { const char *errtype = NULL; if (PyErr_ExceptionMatches(PyExc_UnicodeError)) errtype = "unicode error"; else if (PyErr_ExceptionMatches(PyExc_ValueError)) errtype = "value error"; if (errtype) { char buf[128]; const char *s = NULL; PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); errstr = PyObject_Str(value); if (errstr) s = PyUnicode_AsUTF8(errstr); if (s) { PyOS_snprintf(buf, sizeof(buf), "(%s) %s", errtype, s); } else { PyErr_Clear(); PyOS_snprintf(buf, sizeof(buf), "(%s) unknown error", errtype); } Py_XDECREF(errstr); ast_error(c, n, buf); Py_DECREF(type); Py_XDECREF(value); Py_XDECREF(tback); } return NULL; } return str; } case NUMBER: { PyObject *pynum; const char *s = STR(ch); /* Underscores in numeric literals are only allowed in Python 3.6 or greater */ /* Check for underscores here rather than in parse_number so we can report a line number on error */ if (c->c_feature_version < 6 && strchr(s, '_') != NULL) { ast_error(c, ch, "Underscores in numeric literals are only supported in Python 3.6 and greater"); return NULL; } pynum = parsenumber(c, s); if (!pynum) return NULL; if (PyArena_AddPyObject(c->c_arena, pynum) < 0) { Py_DECREF(pynum); return NULL; } return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena); } case ELLIPSIS: /* Ellipsis */ return Ellipsis(LINENO(n), n->n_col_offset, c->c_arena); case LPAR: /* some parenthesized expressions */ ch = CHILD(n, 1); if (TYPE(ch) == RPAR) return Tuple(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); if (TYPE(ch) == yield_expr) return ast_for_expr(c, ch); /* testlist_comp: test ( comp_for | (',' test)* [','] ) */ if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == comp_for)) return ast_for_genexp(c, ch); return ast_for_testlist(c, ch); case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); if (TYPE(ch) == RSQB) return List(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); REQ(ch, testlist_comp); if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) { asdl_seq *elts = seq_for_testlist(c, ch); if (!elts) return NULL; return List(elts, Load, LINENO(n), n->n_col_offset, c->c_arena); } else return ast_for_listcomp(c, ch); case LBRACE: { /* dictorsetmaker: ( ((test ':' test | '**' test) * (comp_for | (',' (test ':' test | '**' test))* [','])) | * ((test | '*' test) * (comp_for | (',' (test | '*' test))* [','])) ) */ expr_ty res; ch = CHILD(n, 1); if (TYPE(ch) == RBRACE) { /* It's an empty dict. */ return Dict(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); } else { int is_dict = (TYPE(CHILD(ch, 0)) == DOUBLESTAR); if (NCH(ch) == 1 || (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == COMMA)) { /* It's a set display. */ res = ast_for_setdisplay(c, ch); } else if (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == comp_for) { /* It's a set comprehension. */ res = ast_for_setcomp(c, ch); } else if (NCH(ch) > 3 - is_dict && TYPE(CHILD(ch, 3 - is_dict)) == comp_for) { /* It's a dictionary comprehension. */ if (is_dict) { ast_error(c, n, "dict unpacking cannot be used in " "dict comprehension"); return NULL; } res = ast_for_dictcomp(c, ch); } else { /* It's a dictionary display. */ res = ast_for_dictdisplay(c, ch); } if (res) { res->lineno = LINENO(n); res->col_offset = n->n_col_offset; } return res; } } default: PyErr_Format(PyExc_SystemError, "unhandled atom %d", TYPE(ch)); return NULL; } }
static expr_ty ast_for_atom(struct compiling *c, const node *n) { /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictmaker|testlist_comp] '}' | NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' */ node *ch = CHILD(n, 0); switch (TYPE(ch)) { case NAME: { PyObject *name; const char *s = STR(ch); size_t len = strlen(s); if (len >= 4 && len <= 5) { if (!strcmp(s, "None")) return NameConstant(Py_None, LINENO(n), n->n_col_offset, c->c_arena); if (!strcmp(s, "True")) return NameConstant(Py_True, LINENO(n), n->n_col_offset, c->c_arena); if (!strcmp(s, "False")) return NameConstant(Py_False, LINENO(n), n->n_col_offset, c->c_arena); } name = new_identifier(s, c); if (!name) return NULL; /* All names start in Load context, but may later be changed. */ return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); } case STRING: { expr_ty str = parsestrplus(c, n); if (!str) { const char *errtype = NULL; if (PyErr_ExceptionMatches(PyExc_UnicodeError)) errtype = "unicode error"; else if (PyErr_ExceptionMatches(PyExc_ValueError)) errtype = "value error"; if (errtype) { char buf[128]; const char *s = NULL; PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); errstr = PyObject_Str(value); if (errstr) s = PyUnicode_AsUTF8(errstr); if (s) { PyOS_snprintf(buf, sizeof(buf), "(%s) %s", errtype, s); } else { PyErr_Clear(); PyOS_snprintf(buf, sizeof(buf), "(%s) unknown error", errtype); } Py_XDECREF(errstr); ast_error(c, n, buf); Py_DECREF(type); Py_XDECREF(value); Py_XDECREF(tback); } return NULL; } return str; } case NUMBER: { PyObject *pynum; const char *s = STR(ch); /* Underscores in numeric literals are only allowed in Python 3.6 or greater */ /* Check for underscores here rather than in parse_number so we can report a line number on error */ if (c->c_feature_version < 6 && strchr(s, '_') != NULL) { ast_error(c, ch, "Underscores in numeric literals are only supported in Python 3.6 and greater"); return NULL; } pynum = parsenumber(c, STR(ch)); if (!pynum) return NULL; if (PyArena_AddPyObject(c->c_arena, pynum) < 0) { Py_DECREF(pynum); return NULL; } return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena); } case ELLIPSIS: /* Ellipsis */ return Ellipsis(LINENO(n), n->n_col_offset, c->c_arena); case LPAR: /* some parenthesized expressions */ ch = CHILD(n, 1); if (TYPE(ch) == RPAR) return Tuple(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); if (TYPE(ch) == yield_expr) return ast_for_expr(c, ch); /* testlist_comp: test ( comp_for | (',' test)* [','] ) */ if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == comp_for)) return ast_for_genexp(c, ch); return ast_for_testlist(c, ch); case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); if (TYPE(ch) == RSQB) return List(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); REQ(ch, testlist_comp); if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) { asdl_seq *elts = seq_for_testlist(c, ch); if (!elts) return NULL; return List(elts, Load, LINENO(n), n->n_col_offset, c->c_arena); } else return ast_for_listcomp(c, ch); case LBRACE: { /* dictorsetmaker: ( ((test ':' test | '**' test) * (comp_for | (',' (test ':' test | '**' test))* [','])) | * ((test | '*' test) * (comp_for | (',' (test | '*' test))* [','])) ) */ expr_ty res; ch = CHILD(n, 1); if (TYPE(ch) == RBRACE) { /* It's an empty dict. */ return Dict(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); } else { int is_dict = (TYPE(CHILD(ch, 0)) == DOUBLESTAR); if (NCH(ch) == 1 || (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == COMMA)) { /* It's a set display. */ res = ast_for_setdisplay(c, ch); } else if (NCH(ch) > 1 && TYPE(CHILD(ch, 1)) == comp_for) { /* It's a set comprehension. */ res = ast_for_setcomp(c, ch); } else if (NCH(ch) > 3 - is_dict && TYPE(CHILD(ch, 3 - is_dict)) == comp_for) { /* It's a dictionary comprehension. */ if (is_dict) { ast_error(c, n, "dict unpacking cannot be used in " "dict comprehension"); return NULL; } res = ast_for_dictcomp(c, ch); } else { /* It's a dictionary display. */ res = ast_for_dictdisplay(c, ch); } if (res) { res->lineno = LINENO(n); res->col_offset = n->n_col_offset; } return res; } } default: PyErr_Format(PyExc_SystemError, "unhandled atom %d", TYPE(ch)); return NULL; } }
Fully incorporate the code from Python 3.7.2 (#78) This is a full port, following the recipe in update_process.md. I've also tried to keep the recipe up to date and improved the automation (see tools/script). I haven't cleaned up the commits. As of #77 there are a few tests that sanity-check this (though it's far from a full test suite), and they're run by Travis-CI and AppVeyor.
https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce
null
null
ast3/Python/ast.c
0
c
false
2019-01-23T03:09:26Z
async def _complete_login( self, user_id: str, login_submission: JsonDict, callback: Optional[Callable[[LoginResponse], Awaitable[None]]] = None, create_non_existent_users: bool = False, ratelimit: bool = True, auth_provider_id: Optional[str] = None, should_issue_refresh_token: bool = False, auth_provider_session_id: Optional[str] = None, should_check_deactivated: bool = True, ) -> LoginResponse: """Called when we've successfully authed the user and now need to actually login them in (e.g. create devices). This gets called on all successful logins. Applies the ratelimiting for successful login attempts against an account. Args: user_id: ID of the user to register. login_submission: Dictionary of login information. callback: Callback function to run after login. create_non_existent_users: Whether to create the user if they don't exist. Defaults to False. ratelimit: Whether to ratelimit the login request. auth_provider_id: The SSO IdP the user used, if any. should_issue_refresh_token: True if this login should issue a refresh token alongside the access token. auth_provider_session_id: The session ID got during login from the SSO IdP. should_check_deactivated: True if the user should be checked for deactivation status before logging in. This exists purely for appservice's configured sender_localpart which deosn't have an associated user in the database. Returns: Dictionary of account information after successful login. """ # Before we actually log them in we check if they've already logged in # too often. This happens here rather than before as we don't # necessarily know the user before now. if ratelimit: await self._account_ratelimiter.ratelimit(None, user_id.lower()) if create_non_existent_users: canonical_uid = await self.auth_handler.check_user_exists(user_id) if not canonical_uid: canonical_uid = await self.registration_handler.register_user( localpart=UserID.from_string(user_id).localpart ) user_id = canonical_uid # If the account has been deactivated, do not proceed with the login. if should_check_deactivated: deactivated = await self._main_store.get_user_deactivated_status(user_id) if deactivated: raise UserDeactivatedError("This account has been deactivated") device_id = login_submission.get("device_id") # If device_id is present, check that device_id is not longer than a reasonable 512 characters if device_id and len(device_id) > 512: raise LoginError( 400, "device_id cannot be longer than 512 characters.", errcode=Codes.INVALID_PARAM, ) if self._require_approval: approved = await self.auth_handler.is_user_approved(user_id) if not approved: # If the user isn't approved (and needs to be) we won't allow them to # actually log in, so we don't want to create a device/access token. return LoginResponse( user_id=user_id, home_server=self.hs.hostname, ) initial_display_name = login_submission.get("initial_device_display_name") ( device_id, access_token, valid_until_ms, refresh_token, ) = await self.registration_handler.register_device( user_id, device_id, initial_display_name, auth_provider_id=auth_provider_id, should_issue_refresh_token=should_issue_refresh_token, auth_provider_session_id=auth_provider_session_id, ) result = LoginResponse( user_id=user_id, access_token=access_token, home_server=self.hs.hostname, device_id=device_id, ) if valid_until_ms is not None: expires_in_ms = valid_until_ms - self.clock.time_msec() result["expires_in_ms"] = expires_in_ms if refresh_token is not None: result["refresh_token"] = refresh_token if callback is not None: await callback(result) return result
async def _complete_login( self, user_id: str, login_submission: JsonDict, callback: Optional[Callable[[LoginResponse], Awaitable[None]]] = None, create_non_existent_users: bool = False, ratelimit: bool = True, auth_provider_id: Optional[str] = None, should_issue_refresh_token: bool = False, auth_provider_session_id: Optional[str] = None, should_check_deactivated: bool = True, ) -> LoginResponse: """Called when we've successfully authed the user and now need to actually login them in (e.g. create devices). This gets called on all successful logins. Applies the ratelimiting for successful login attempts against an account. Args: user_id: ID of the user to register. login_submission: Dictionary of login information. callback: Callback function to run after login. create_non_existent_users: Whether to create the user if they don't exist. Defaults to False. ratelimit: Whether to ratelimit the login request. auth_provider_id: The SSO IdP the user used, if any. should_issue_refresh_token: True if this login should issue a refresh token alongside the access token. auth_provider_session_id: The session ID got during login from the SSO IdP. should_check_deactivated: True if the user should be checked for deactivation status before logging in. This exists purely for appservice's configured sender_localpart which doesn't have an associated user in the database. Returns: Dictionary of account information after successful login. """ # Before we actually log them in we check if they've already logged in # too often. This happens here rather than before as we don't # necessarily know the user before now. if ratelimit: await self._account_ratelimiter.ratelimit(None, user_id.lower()) if create_non_existent_users: canonical_uid = await self.auth_handler.check_user_exists(user_id) if not canonical_uid: canonical_uid = await self.registration_handler.register_user( localpart=UserID.from_string(user_id).localpart ) user_id = canonical_uid # If the account has been deactivated, do not proceed with the login. if should_check_deactivated: deactivated = await self._main_store.get_user_deactivated_status(user_id) if deactivated: raise UserDeactivatedError("This account has been deactivated") device_id = login_submission.get("device_id") # If device_id is present, check that device_id is not longer than a reasonable 512 characters if device_id and len(device_id) > 512: raise LoginError( 400, "device_id cannot be longer than 512 characters.", errcode=Codes.INVALID_PARAM, ) if self._require_approval: approved = await self.auth_handler.is_user_approved(user_id) if not approved: # If the user isn't approved (and needs to be) we won't allow them to # actually log in, so we don't want to create a device/access token. return LoginResponse( user_id=user_id, home_server=self.hs.hostname, ) initial_display_name = login_submission.get("initial_device_display_name") ( device_id, access_token, valid_until_ms, refresh_token, ) = await self.registration_handler.register_device( user_id, device_id, initial_display_name, auth_provider_id=auth_provider_id, should_issue_refresh_token=should_issue_refresh_token, auth_provider_session_id=auth_provider_session_id, ) result = LoginResponse( user_id=user_id, access_token=access_token, home_server=self.hs.hostname, device_id=device_id, ) if valid_until_ms is not None: expires_in_ms = valid_until_ms - self.clock.time_msec() result["expires_in_ms"] = expires_in_ms if refresh_token is not None: result["refresh_token"] = refresh_token if callback is not None: await callback(result) return result
Fix typos. Co-authored-by: David Robertson <davidr@element.io>
https://github.com/matrix-org/synapse/commit/07e16191a10c1e3355e6263acf0e8fa5eb8905c7
null
null
synapse/rest/client/login.py
0
py
false
null
int cp_vbnn_ver(const ec_t r, const bn_t z, const bn_t h, const uint8_t *id, size_t id_len, const uint8_t *msg, int msg_len, const ec_t mpk) { int len, result = 0; uint8_t *buf = NULL, *buf_i, hash[RLC_MD_LEN]; bn_t n, c, _h; ec_t Z; ec_t t; /* zero variables */ bn_null(n); bn_null(c); bn_null(_h); ec_null(Z); ec_null(t); RLC_TRY { bn_new(n); bn_new(c); bn_new(_h); ec_new(Z); ec_new(t); /* calculate c */ len = id_len + msg_len + 2 * ec_size_bin(r, 1); buf = RLC_ALLOCA(uint8_t, len); if (buf == NULL) { RLC_THROW(ERR_NO_MEMORY); } /* get order of ECC group */ ec_curve_get_ord(n); buf_i = buf; memcpy(buf_i, id, id_len); buf_i += id_len; ec_write_bin(buf_i, ec_size_bin(r, 1), r, 1); len = id_len + ec_size_bin(r, 1); md_map(hash, buf, len); bn_read_bin(c, hash, RLC_MD_LEN); bn_mod(c, c, n); /* calculate Z */ ec_mul_gen(Z, z); ec_mul(t, mpk, c); ec_add(t, t, r); ec_norm(t, t); ec_mul(t, t, h); ec_sub(Z, Z, t); ec_norm(Z, Z); /* calculate h_verify */ buf_i = buf; memcpy(buf_i, id, id_len); buf_i += id_len; memcpy(buf_i, msg, msg_len); buf_i += msg_len; ec_write_bin(buf_i, ec_size_bin(r, 1), r, 1); buf_i += ec_size_bin(r, 1); ec_write_bin(buf_i, ec_size_bin(Z, 1), Z, 1); len = id_len + msg_len + ec_size_bin(r, 1) + ec_size_bin(Z, 1); md_map(hash, buf, len); bn_read_bin(_h, hash, RLC_MD_LEN); bn_mod(_h, _h, n); RLC_FREE(buf); if (bn_cmp(h, _h) == RLC_EQ) { result = 1; } else { result = 0; } }
int cp_vbnn_ver(const ec_t r, const bn_t z, const bn_t h, const uint8_t *id, size_t id_len, const uint8_t *msg, int msg_len, const ec_t mpk) { size_t len; uint8_t *buf = NULL, *buf_i, hash[RLC_MD_LEN]; bn_t n, c, _h; ec_t Z, t; int result = 0; /* zero variables */ bn_null(n); bn_null(c); bn_null(_h); ec_null(Z); ec_null(t); RLC_TRY { bn_new(n); bn_new(c); bn_new(_h); ec_new(Z); ec_new(t); /* calculate c */ len = id_len + msg_len + 2 * ec_size_bin(r, 1); buf = RLC_ALLOCA(uint8_t, len); if (buf == NULL) { RLC_THROW(ERR_NO_MEMORY); } /* get order of ECC group */ ec_curve_get_ord(n); buf_i = buf; memcpy(buf_i, id, id_len); buf_i += id_len; ec_write_bin(buf_i, ec_size_bin(r, 1), r, 1); len = id_len + ec_size_bin(r, 1); md_map(hash, buf, len); bn_read_bin(c, hash, RLC_MD_LEN); bn_mod(c, c, n); /* calculate Z */ ec_mul_gen(Z, z); ec_mul(t, mpk, c); ec_add(t, t, r); ec_norm(t, t); ec_mul(t, t, h); ec_sub(Z, Z, t); ec_norm(Z, Z); /* calculate h_verify */ buf_i = buf; memcpy(buf_i, id, id_len); buf_i += id_len; memcpy(buf_i, msg, msg_len); buf_i += msg_len; ec_write_bin(buf_i, ec_size_bin(r, 1), r, 1); buf_i += ec_size_bin(r, 1); ec_write_bin(buf_i, ec_size_bin(Z, 1), Z, 1); len = id_len + msg_len + ec_size_bin(r, 1) + ec_size_bin(Z, 1); md_map(hash, buf, len); bn_read_bin(_h, hash, RLC_MD_LEN); bn_mod(_h, _h, n); RLC_FREE(buf); if (bn_cmp(h, _h) == RLC_EQ) { result = 1; } else { result = 0; } }
Huge commit improving the API to use size_t instead of int.
https://github.com/relic-toolkit/relic/commit/34580d840469361ba9b5f001361cad659687b9ab
null
null
src/cp/relic_cp_vbnn.c
0
c
false
2022-11-14T20:47:12Z
def remove_duplicates( items: Iterable[InputType], key: Optional[Callable[[InputType], Any]] = None ) -> List[InputType]: """Remove duplicate items in an iterable.""" if not key: return list(dict.fromkeys(items).keys()) seen = set() result = [] for item in items: item_key = key(item) if item_key not in seen: seen.add(item_key) result.append(item) return result
def remove_duplicates( items: Iterable[InputType], key: Callable[[InputType], Any] | None = None ) -> list[InputType]: """Remove duplicate items in an iterable.""" if not key: return list(dict.fromkeys(items).keys()) seen = set() result = [] for item in items: item_key = key(item) if item_key not in seen: seen.add(item_key) result.append(item) return result
Merge branch 'master' into fix/db-val-param-perms
https://github.com/apache/superset/commit/4e2fd6f4f04c61e8c1d3ec3f233581a05f8b6213
null
null
superset/utils/core.py
0
py
false
2023-06-05T08:42:54Z
static int setupStream(PRTSP_MESSAGE response, char* target, int* error) { RTSP_MESSAGE request; int ret; char* transportValue; *error = -1; ret = initializeRtspRequest(&request, "SETUP", target); if (ret != 0) { if (hasSessionId) { if (!addOption(&request, "Session", sessionIdString)) { ret = 0; goto FreeMessage; } } if (ServerMajorVersion >= 6) { // It looks like GFE doesn't care what we say our port is but // we need to give it some port to successfully complete the // handshake process. transportValue = "unicast;X-GS-ClientPort=50000-50001"; } else { transportValue = " "; } if (addOption(&request, "Transport", transportValue) && addOption(&request, "If-Modified-Since", "Thu, 01 Jan 1970 00:00:00 GMT")) { ret = transactRtspMessage(&request, response, 0, error); } else { ret = 0; } FreeMessage: freeMessage(&request); } return ret; }
static int setupStream(PRTSP_MESSAGE response, char* target, int* error) { RTSP_MESSAGE request; int ret; char* transportValue; *error = -1; ret = initializeRtspRequest(&request, "SETUP", target); if (ret != 0) { if (hasSessionId) { if (!addOption(&request, "Session", sessionIdString)) { ret = 0; goto FreeMessage; } } if (AppVersionQuad[0] >= 6) { // It looks like GFE doesn't care what we say our port is but // we need to give it some port to successfully complete the // handshake process. transportValue = "unicast;X-GS-ClientPort=50000-50001"; } else { transportValue = " "; } if (addOption(&request, "Transport", transportValue) && addOption(&request, "If-Modified-Since", "Thu, 01 Jan 1970 00:00:00 GMT")) { ret = transactRtspMessage(&request, response, 0, error); } else { ret = 0; } FreeMessage: freeMessage(&request); } return ret; }
API update to provide enough information to support GFE 3.0.7
https://github.com/moonlight-stream/moonlight-common-c/commit/f57bd745b4cbed577ea654fad4701bea4d38b44c
null
null
src/RtspConnection.c
0
c
false
null
public boolean isAfterLast() throws SQLException { return !open && !emptyResultSet; }
public boolean isAfterLast() { return !open && !emptyResultSet; }
fix(jdbc): getDate, getTime, and getTimestamp crash on empty text Closes: #490
https://github.com/xerial/sqlite-jdbc/commit/bc5174ba197e6e6a1d054542d3e63f1e7d09ccd9
null
null
src/main/java/org/sqlite/jdbc3/JDBC3ResultSet.java
0
java
false
2022-08-30T08:31:15Z
function x(t,e){var n=L(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(b,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}
function x(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=new Array(r),i=0;i<r;i++)n[i]=t[i+e];return n}
[API] Update swagger version
https://github.com/mailcow/mailcow-dockerized/commit/000894dabda7c2116f43ad6ff926962295d8095c
CVE-2022-39258
['CWE-200', 'CWE-451', 'CWE-601']
data/web/api/swagger-ui-standalone-preset.js
0
js
false
2022-09-26T13:56:24Z
End of preview. Expand in Data Studio

Dataset Card for CleanVul

CleanVul is a function-level vulnerability dataset derived from vulnerability-fixing commits. It provides paired before/after function snapshots and metadata produced by an LLM-assisted heuristic pipeline (VulSifter) to identify which changed functions are likely to correspond to vulnerability fixes.

Dataset Details

CleanVul targets the noise present in many vulnerability datasets that label all modified files or functions in vulnerability-fixing commits as vulnerability-related. The dataset is constructed by applying VulSifter, which combines LLM-based semantic inspection with filtering heuristics (e.g., to remove test-related changes). CleanVul is released in multiple confidence “threshold” variants so users can trade off dataset size and label correctness.

  • Curated by: Yikun Li, Ting Zhang, Ratnadira Widyasari, Yan Naing Tun, Huu Hung Nguyen, Tan Bui, Ivana Clairine Irsan, Yiran Cheng, Xiang Lan, Han Wei Ang, et al.
  • Language(s): Source code (multilingual). Reported language coverage includes Java, Python, C, JavaScript, C#, and C++.
  • Paper: arXiv:2411.17274 (CleanVul: Automatic Function-Level Vulnerability Detection in Code Commits Using LLM Heuristics)

Dataset Structure

CleanVul is released in multiple score-based CSV files. Pairs are stored separately by vulnerability score and can be combined to form thresholded subsets:

  • vulnerability_score_3.csv: items with score = 3
  • vulnerability_score_4.csv: items with score = 4

To reconstruct the commonly used “Threshold 3” subset (score ≥ 3), combine:

  • score = 3 (6,368 items) + score = 4 (1,830 items) = 8,198 items

Citation

@article{li2024cleanvul,
  title={CleanVul: Automatic Function-Level Vulnerability Detection in Code Commits Using LLM Heuristics},
  author={Li, Yikun and Zhang, Ting and Widyasari, Ratnadira and Tun, Yan Naing and Nguyen, Huu Hung and Bui, Tan and Irsan, Ivana Clairine and Cheng, Yiran and Lan, Xiang and Ang, Han Wei and others},
  journal={arXiv preprint arXiv:2411.17274},
  year={2024}
}
Downloads last month
26

Paper for yikun-li/CleanVul