Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault when call function PutMinGate() #183

Open
L-coder148 opened this issue Nov 12, 2021 · 1 comment
Open

segmentation fault when call function PutMinGate() #183

L-coder148 opened this issue Nov 12, 2021 · 1 comment

Comments

@L-coder148
Copy link

Hello, I want to find the minmum vaule of array distance. the minmum vaule is assigned to mindist. the code is as follows, when I run it, it occurs the segmentation fault error.

BooleanCircuit *cmpcirc = (BooleanCircuit *)sharings[S_YAO]->GetCircuitBuildRoutine();
    assert(cmpcirc->GetCircuitType() == C_BOOLEAN);

    share **distance;
    distance = (share **)malloc(sizeof(share *) * 3);

    //distance[0]=s00+s01,distance[1]=s10+s11......
    uint32_t s00 = 2, s01 = 2, s10 = 4, s11 = 4, s20 = 6, s21 = 6;

    share *mindist;

    if (role == SERVER)
    {
        distance[0] = cmpcirc->PutSharedINGate(s00, bitlen);
        distance[1] = cmpcirc->PutSharedINGate(s10, bitlen);
        distance[2] = cmpcirc->PutSharedINGate(s20, bitlen);
    }
    else if (role = CLIENT)
    {
        distance[0] = cmpcirc->PutSharedINGate(s01, bitlen);
        distance[1] = cmpcirc->PutSharedINGate(s11, bitlen);
        distance[2] = cmpcirc->PutSharedINGate(s21, bitlen);
    }
    mindist = cmpcirc->PutMinGate(distance, 3);

    free(distance);

    mindist = cmpcirc->PutOUTGate(mindist, ALL);

    std::cout << "*****1" << std::endl;
    party->ExecCircuit();
    std::cout << "*****2" << std::endl;

image
Hope for your guidance!

@iamliusiyuan
Copy link

Same question. Have u solved this?

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

No branches or pull requests

2 participants