Skip to content

BridJ: Unaligned pointer access (OS X) #568

Description

@p8a

I'm having troubles wrapping libyara using BridJ (0.7.0), for parameters passed back using callbacks I always get "Unaligned pointer access". I am on Mac OS X and the binding code was generated with JNAerator.

This the code I'm having troubles with:

This is the Java code:

@OverRide
public int apply(int message, Pointer rulePtr, Pointer dataPtr) {
if (message != YaraLibrary.CALLBACK_MSG_RULE_MATCHING) {
return YaraLibrary.CALLBACK_CONTINUE;
}

            Pointer<YR_RULE> rule = rulePtr.as(YR_RULE.class);

            int g = rule.get().g_flags(); <-- Unaligned pointer access

And this is the YR_RULE definition:

@Library("yara")
public class YR_RULE extends StructObject {
static {
BridJ.register();
}
/** Global flags */
@field(0)
public int g_flags() {
return this.io.getIntField(this, 0);
}

Any ideas how to fix this ?

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions