RFR: 8320219: Actually resolve issues with goto labels in sspi [v4]
Weijun Wang
weijun at openjdk.org
Tue Dec 5 15:09:40 UTC 2023
On Mon, 4 Dec 2023 09:26:57 GMT, Julian Waters <jwaters at openjdk.org> wrote:
>> I regret not actually addressing the issues with the goto labels in https://github.com/openjdk/jdk/pull/15996, where initialization of locals in sspi were jumped over by gotos to a certain label. I changed the initializations into split declarations and assignments in https://github.com/openjdk/jdk/pull/15996, but this is simply a hack and does not address the real issue of gotos jumping over locals. I've as such fixed the issues with them properly this time, by simply deleting the labels and duplicating the code where they're used. As mentioned, this unfortunately does increase duplicate code, but is the cleanest solution I could come up with for the labels
>
> Julian Waters 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 four additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into patch-9
> - NULL to nullptr in sspi.cpp
> - Missed labels in sspi.cpp
> - Actually resolve issues with goto labels in sspi
I still don't like this solution:
1. Duplicated lines.
2. There are other `goto`s in this file. I know they happen to be unaffected, but if `goto` is not recommended in C++ it looks unfair to remove some and keep some.
Can we throw and catch exceptions? Or, how difficult is it to rewrite to simply C? Just substitute `new` and `delete` with `malloc` and `free`?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16682#issuecomment-1840980100
More information about the security-dev
mailing list