RFR: 8320219: Actually resolve issues with goto labels in sspi [v9]

Daniel Jeliński djelinski at openjdk.org
Fri Jan 19 19:45:29 UTC 2024


On Fri, 19 Jan 2024 01:57:40 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 incrementally with one additional commit since the last revision:
> 
>   std:: qualifier sspi.cpp

AFAICT these changes are not necessary.

### C++11 §6.7/3:

> [...] A program that jumps from a point where a variable with automatic storage duration is not in scope to a point where it is in scope is ill-formed **unless the variable has scalar type**, class type with a trivial default constructor and a trivial destructor, a cv-qualified version of one of these types, or an array of one of the preceding types and is declared without an initializer (8.5).

all the variables jumped over are scalars (ints and pointers), so the code is correct. Am I missing something?

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

PR Review: https://git.openjdk.org/jdk/pull/16682#pullrequestreview-1833557310



More information about the security-dev mailing list