linkedin / linkedin/URL-Detector
Long run of periods causes detect() to throw NegativeArraySizeException "Backtracked max amount of characters. Endless loop detected."
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 785
- Forks
- 184
- PR merge metrics
- No merged PRs in 30d
Description
String text = ".............:::::::::::;;;;;;;;;;;;;;;::...............................................:::::::::::::::::::::::::::::....................";
UrlDetector d = new UrlDetector(text, UrlDetectorOptions.Default);
d.detect();
Running this will throw
Exception in thread "main" java.lang.NegativeArraySizeException: Backtracked max amount of characters. Endless loop detected. Bad Text: ':...............................................:::::::::::::::::::::::::::::....................'
at com.linkedin.urls.detection.InputTextReader.checkBacktrackLoop(InputTextReader.java:144)
at com.linkedin.urls.detection.InputTextReader.seek(InputTextReader.java:120)
at com.linkedin.urls.detection.UrlDetector.readUserPass(UrlDetector.java:511)
at com.linkedin.urls.detection.UrlDetector.readScheme(UrlDetector.java:458)
at com.linkedin.urls.detection.UrlDetector.processColon(UrlDetector.java:293)
at com.linkedin.urls.detection.UrlDetector.readDefault(UrlDetector.java:253)
at com.linkedin.urls.detection.UrlDetector.detect(UrlDetector.java:142)
at Main.main(Main.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the supplied Java reproduction and trace the failing path through InputTextReader.java and UrlDetector.java, starting at detect() and the reported checkBacktrackLoop() call. Done means the input no longer causes NegativeArraySizeException when detect() runs; the issue does not specify the expected detection result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100