@@ -81,6 +81,7 @@ public static final class Raw {
81
81
@ TruffleBoundary
82
82
public static @ JavaType (String [].class ) StaticObject platformProperties (@ Inject EspressoContext ctx , @ Inject TruffleIO io ) {
83
83
// Import properties from host.
84
+ // All of those assignments should be considered as InformationLeaks!
84
85
Props props = new Props (ctx );
85
86
String [] known = new String [props .fixedLength ];
86
87
known [props .userHomeNdx ] = java .lang .System .getProperty ("user.home" );
@@ -93,10 +94,10 @@ public static final class Raw {
93
94
}
94
95
if (ctx .getJavaVersion ().java25OrLater ()) {
95
96
known [props .nativeEncodingNDX ] = java .lang .System .getProperty ("native.encoding" );
97
+ known [props .stdinEncodingNdx ] = java .lang .System .getProperty ("stdin.encoding" );
96
98
}
97
99
known [props .stdoutEncodingNdx ] = java .lang .System .getProperty ("stdout.encoding" );
98
100
known [props .stderrEncodingNdx ] = java .lang .System .getProperty ("stderr.encoding" );
99
- known [props .stdinEncodingNdx ] = java .lang .System .getProperty ("stdin.encoding" );
100
101
101
102
known [props .osNameNdx ] = java .lang .System .getProperty ("os.name" );
102
103
known [props .osArchNdx ] = java .lang .System .getProperty ("os.arch" );
@@ -150,8 +151,6 @@ private static final class Props {
150
151
private final int displayLanguageNdx ;
151
152
private final int displayScriptNdx ;
152
153
private final int displayVariantNdx ;
153
- // only in 21-
154
- private final int fileEncodingNdx ;
155
154
private final int fileSeparatorNdx ;
156
155
private final int formatCountryNdx ;
157
156
private final int formatLanguageNdx ;
@@ -171,13 +170,10 @@ private static final class Props {
171
170
private final int osNameNdx ;
172
171
private final int osVersionNdx ;
173
172
private final int pathSeparatorNdx ;
174
- // only in 25+
175
- private final int nativeEncodingNDX ;
176
173
private final int socksNonProxyHostsNdx ;
177
174
private final int socksProxyHostNdx ;
178
175
private final int socksProxyPortNdx ;
179
176
private final int stderrEncodingNdx ;
180
- private final int stdinEncodingNdx ;
181
177
private final int stdoutEncodingNdx ;
182
178
private final int sunArchAbiNdx ;
183
179
private final int sunArchDataModelNdx ;
@@ -190,6 +186,11 @@ private static final class Props {
190
186
private final int userHomeNdx ;
191
187
private final int userNameNdx ;
192
188
private final int fixedLength ;
189
+ // only in 21-
190
+ private final int fileEncodingNdx ;
191
+ // only in 25+
192
+ private final int nativeEncodingNDX ;
193
+ private final int stdinEncodingNdx ;
193
194
194
195
private Props (EspressoContext ctx ) {
195
196
ObjectKlass guestRaw = ctx .getMeta ().jdk_internal_util_SystemProps_Raw ;
@@ -204,8 +205,10 @@ private Props(EspressoContext ctx) {
204
205
}
205
206
if (ctx .getJavaVersion ().java25OrLater ()) {
206
207
nativeEncodingNDX = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_native_encoding_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
208
+ stdinEncodingNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_stdin_encoding_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
207
209
} else {
208
210
nativeEncodingNDX = -1 ;
211
+ stdinEncodingNdx = -1 ;
209
212
}
210
213
fileSeparatorNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_file_separator_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
211
214
formatCountryNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_format_country_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
@@ -230,7 +233,6 @@ private Props(EspressoContext ctx) {
230
233
socksProxyHostNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_socksProxyHost_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
231
234
socksProxyPortNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_socksProxyPort_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
232
235
stderrEncodingNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_stderr_encoding_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
233
- stdinEncodingNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_stdin_encoding_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
234
236
stdoutEncodingNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_stdout_encoding_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
235
237
sunArchAbiNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_sun_arch_abi_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
236
238
sunArchDataModelNdx = guestRaw .lookupDeclaredField (ctx .getNames ().getOrCreate ("_sun_arch_data_model_NDX" ), Types ._int ).getInt (guestRaw .tryInitializeAndGetStatics ());
0 commit comments