Skip to content

Defensive code for '0' length bootstrap methods in constant pool

Jeffrey Phillips Freeman requested to merge defensive-0 into master

This was pulled in from github here:https://github.com/Syncleus/aparapi/pull/162

Original comment by Gary Frost:

I hit this recently in some Java 8 code. Have been sitting on this patch for a while. Figured I would push it up hill.

Basically, the code was previously using 'uninitialized' (so 0) value in numBootStrapMethods, rather than using the length of the incoming methods array.

So here I initialize numBootStrapMethods using methods.length and only pull the methods if numBootStrapMethods != 0

Truthfully we can't use any code from kernel that needs these bootstrap methods, but at least here we can parse the code correctly, allowing the class to load. Maybe some helper methods (not reachable from run()) can now use them.

Merge request reports