JDK-8187223 : Long JNLP file is not parsed correctly and ends with javaws path
  • Type: Bug
  • Component: deploy
  • Sub-Component: webstart
  • Affected Version: 8u144,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2017-08-22
  • Updated: 2018-10-16
  • Resolved: 2018-04-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u181Fixed
Description
FULL PRODUCT VERSION :
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 10.0.15063]

A DESCRIPTION OF THE PROBLEM :
We have a very long URL-path which is called incorrectly. 
After exactly 960 characters the path in which the javaws.exe resides is appended.

That leads of course to the incorrect loading of the jnlp file - 
which is less than the allowed 2048 characters long.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The jnlp file send to the webserver should be complete.
For example :

http[s]://thisisaverylong.path/[���]/960th character961st character/���
ACTUAL -
This is the actual result which is sent to the webserver:

http[s]://thisisaverylong.path/[���]/960th characterC:\Program Files\Java\jre1.8.0_144\bin\javaws.exe

REPRODUCIBILITY :
This bug can be reproduced always.


Comments
CPU18_07-critical-request - Justification : sustaining and customer request - Risk Analysis : Low. - Testing (done/to-be-done) : Tested by manually running above app. - Back ports (done/to-be-done) : none - FX Impact : N/A - Fix For Release : 8u181
18-04-2018

note : even though the givenexample shows the problem, it doesn't properly show when the problem is fixed, since the given file : "http://webbugs.us.oracle.com:9090/bugreports/9050571/jnlptest.php?thisisaverylongbutnecessaryurlveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylong" references a file that doesn't exist. You can see the fix by looking at the error message, it says the above does not exist instead of the wrong path shown in the description: http[s]://thisisaverylong.path/eeeeeeeeeee[���]/960th characterC:\Program Files\Java\jre1.8.0_144\bin\javaws.exe
13-04-2018

The same code in JDK8u is in launchJavaWS in deploy/src/plugin/win32/plugin2/jp2launcher/JP2Launcher.cpp (except using TCHAR instead of char)
05-09-2017

The problem is that in windows/native/common.h, MAX_BUFFER is defined as 1024 in windows/native/jweblauncher/launcher_md.cpp we have: char commandLine[MAX_BUFFER] = {0}; ... _snprintf(commandLine, MAX_BUFFER, "\"%s\" \"%s\"", executable, argv[2]); in this case MAX_BUFFER is too small , and no check of the return value is made. (in this case will return a value greater than MAX_BUFFER). using MAX_BUFFER_SIZE will fix this particular case (it is 2048), but we should also check that return value is > 0 and < MAX_BUFFER_SIZE.
05-09-2017

running with the default program (jweblauncher.-securejre %1) shows the problem, yet running with javaws directly shows the proper error message, (the file "example.jnlp" referred to in the php does not exist) To make example more clear, I will upload an invalid jnlp file "example.jnlp", and when working properly the error shown should refer to the contents of that jnlp file.
05-09-2017

Windows 10 (64-bit) Checked this for JDK 8u144 b01 and 9 ea b181 and could confirm the issue as reported. Result: ======== 8u144 b01: FAIL 9 ea b181: FAIL Long JNLP file is not parsed correctly and ends with javaws path. To reproduce, run the example provided in subsequent comment (steps provided)
05-09-2017