On Wed, 20 May 2026 10:59:50 GMT, Jaikiran Pai <[email protected]> wrote:

>> SendaoYan has updated the pull request with a new target base due to a merge 
>> or a rebase. The incremental webrev excludes the unrelated changes brought 
>> in by the merge/rebase. The pull request contains two additional commits 
>> since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into jbs8381851
>>  - 8381851: handleMessage use uninitialized struct
>
> src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c line 392:
> 
>> 390:    jboolean isEOR, struct sockaddr* sap) {
>> 391:     jobject isa, resultObj;
>> 392:     struct controlData cdata[1] = {0};
> 
> Initializing each of the fields on the `controlData` struct instance to `0`, 
> looks OK to me.
> 
> A larger question however is how this code should deal with the case where 
> the implementation in `getControlData(msg, cdata)` doesn't set/overwrite this 
> instance's field values i.e. if there are no messages which have 
> `cmsg->cmsg_level == IPPROTO_SCTP && cmsg->cmsg_type == SCTP_SNDRCV`. It 
> looks like we don't check for that possibility after we return from that call 
> to `getControlData()` and go ahead and construct the MessageInfoImpl with the 
> now default values of `0` for these fields. But that part of the code is 
> pre-existing and your proposed change here in fact improves the situation by 
> setting it to a default value.

I am not familiar to those sctp codes. Maybe there are always have at least one 
message which have `cmsg->cmsg_level == IPPROTO_SCTP && cmsg->cmsg_type == 
SCTP_SNDRCV`, so there is no sctp bug reported for now. Or maybe little people 
use sctp through java?

Anyway, initial the struct variable do avoid jvm crash which build by 
clang23/llvm23, and the sctp tests run passed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30664#discussion_r3274002418

Reply via email to