Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

ELFlash sometimes throws ArrayIndexOutOfBoundsException if cookie contains invalid values #4386

Open
erdbeerschnitzel opened this issue Nov 2, 2018 · 1 comment

Comments

@erdbeerschnitzel
Copy link

JSF-Version 2.2.18

The Flash cookie ("csfcfc") with value '7aXBAow%3D' can result in:

java.lang.ArrayIndexOutOfBoundsException: null
--
at java.lang.System.arraycopy(Native Method)
at com.sun.faces.util.ByteArrayGuardAESCTR.decrypt(ByteArrayGuardAESCTR.java:158)
at com.sun.faces.context.flash.ELFlash$PreviousNextFlashInfoManager.decode(ELFlash.java:1414)
at com.sun.faces.context.flash.ELFlash.getCurrentFlashManager(ELFlash.java:1235)
at com.sun.faces.context.flash.ELFlash.doPrePhaseActions(ELFlash.java:619)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:215)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:123)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)

I guess the problem is in the method

private PreviousNextFlashInfoManager getCurrentFlashManager(FacesContext context, Map<Object, Object> contextMap, Cookie cookie)

because only InvalidKeyException is caught there.

@nalmeida84
Copy link

Same problem, solved clearing the cookies. Thanks for your post!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants