> Hi all, > > Function handleMessage in file > src/jdk.sctp/unix/native/libsctp/SctpChannelImpl.c declare 'struct > controlData cdata[1]' but do not initiali the struct variable. After the > declation, the cdata will write the related data through funciton call > 'getControlData(msg, cdata)', and the data will be readed through > '(*env)->NewObject'. During 'getControlData(msg, cdata)' call the cdate maybe > unchange and then return. > > In C/C++, read the variable which has not been uninitializaed is undefined > behavior. I think it's better to initial the cdata, this will avoid the > compiler use too aggressive optimilization. > > Before this PR, com/sun/nio/sctp/SctpChannel/ReceiveIntoDirect.java crash 'C > [libsctp.so+0x3b3e] handleMessage+0x4e' with clang23/llvm23 release build . > After this PR test run passed. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
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 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/30664/files - new: https://git.openjdk.org/jdk/pull/30664/files/c6e91848..a450df52 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=30664&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=30664&range=00-01 Stats: 139978 lines in 3215 files changed: 53834 ins; 74494 del; 11650 mod Patch: https://git.openjdk.org/jdk/pull/30664.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/30664/head:pull/30664 PR: https://git.openjdk.org/jdk/pull/30664
