Hi:
There are a few line of source code of DefaultChannel's initChannel methods,
may cause stack overflow potentially. 
Although camel will never cause such a bug in current release version, (I
explain in the following comments), but in future , if some change is made,
a stack overflow bug may occurs; 
        I tagged the explain with "@1", 

DefaultChannel. initChannel(){
......

for (InterceptStrategy strategy : interceptors) {
  next = target == nextProcessor ? null : nextProcessor;
  if (strategy instanceof Tracer) {
    continue;
   }
   Processor wrapped =
strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(),
outputDefinition, target, next); 
  if (!(wrapped instanceof AsyncProcessor)) {
//@1 now camle will never execute in this block, because the wrapped always
be a  async-processor(actually , it's a tracer);
//@1 but if something changed, it will not be a AsyncProcessor, then a
potential stack overflow bug will occurs;

  InterceptorToAsyncProcessorBridge bridge = new
InterceptorToAsyncProcessorBridge(target);

//@1 the returned wrapped may equals bridge itself, if the strategy do
nothing;     
  wrapped =
strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(),
outputDefinition, bridge, next);
//@1 here bridge's target may point to itself, so a stack over flow bug will
raised; suggest to make sure if wrapped == bridge
     bridge.setTarget(wrapped);
                wrapped = bridge;
            }
            target = wrapped;
        }



Reply via email to