Syncleus / aparapi

The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.
http://aparapi.com
Apache License 2.0
465 stars 59 forks source link

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

Closed grfrost closed 3 years ago

grfrost commented 3 years ago

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.

freemo commented 3 years ago

This looks great, ill do a quick review and if all looks good ill merge it. Thanks for the contribution.

freemo commented 3 years ago

This has been moved over to an identical merge request at the official repo here: https://git.qoto.org/aparapi/aparapi/-/merge_requests/6

As such closing on github and will continue to work on it from gitlab.

@grfrost