You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Priority comparator overflow in ServicePriority #1797
ServicePriority backs WorkflowUtils.loadFirst, the ServiceLoader-based selection mechanism used by most extension points in the SDK (WorkflowModelFactory, SchemaValidatorFactory, TaskExecutorFactory, EventConsumer, CronResolverFactory, ConfigManager, SecretManager, URITemplateResolver, FunctionReader, CloudEventPredicateFactory, ObjectMapperFactory, AccessTokenProviderFactory, CustomObjectMarshaller, WorkflowDecorator, among others).
What you expected to happen:
This overflows int when an implementor returns a priority() close to Integer.MIN_VALUE/Integer.MAX_VALUE to force "always win"/"always lose" semantics, causing the wrong implementation to be picked by WorkflowUtils.loadFirst silently, with no exception. Same root cause as #1795, but affecting the shared mechanism behind nearly every ServiceLoader-based extension point in the SDK, not just ExpressionFactory.
How to reproduce it:
Register two ServicePriority implementations via ServiceLoader: one with the plain DEFAULT_PRIORITY, another overriding priority() to return Integer.MIN_VALUE so it should always win. Call WorkflowUtils.loadFirst. The DEFAULT_PRIORITY one wins instead.
Anything else we need to know?:
Same fix as #1795: replace the subtraction with Integer.compare(this.priority(), other.priority()).
Activity