Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with a specific regex pattern #1288

Open
mpeter50 opened this issue Jul 22, 2024 · 0 comments
Open

Crash with a specific regex pattern #1288

mpeter50 opened this issue Jul 22, 2024 · 0 comments
Labels

Comments

@mpeter50
Copy link

lnav version
v0.12.2

Describe the bug
When I use a specific regex pattern, lnav crashes on startup. The crash happens before patterns would be validated against the samples.

The regex pattern in question is the following:

^(?J:(?:(?<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d+) (?:(?<level>[A-Z]+)  \[(?<module>[\w \/]+)\] (?<component>[\w.]+): (?<body>.*)|(?:(?:\^){3} \d+ similar messages omitted (?:\^){3})))|(?:(?:(?:[\w.]+(?<level>Exception):)|(?:\	at)) .*)|(?:(?:\*{3} .*)|(?:Starting I2P.*)|(?:\[startapp].*)))$

To Reproduce
Steps to reproduce the behavior:

  1. Take the i2p_router_log.json from this commit: ce88dce (this should be the same as the above, but doubly escaped for JSON)
  2. Put that in a new format definition
  3. Start lnav for any log file, or without one with lnav -N

I'll send the crash log in email.

This pattern is so complicated for the reason that the software it was made for produces several different kinds of log lines.
The top level group is for setting a regex flag.
There are 3 variants in it, each in its own group, for the primary log lines, Java exceptions, and the log format that is used at startup.
If any one of the first 2 variants are taken out, lnav does not crash anymore. That way the pattern looks like the following:
Without the primary format:

^(?J:(?:(?:(?:[\w.]+(?<level>Exception):)|(?:\	at)) .*)|(?:(?:\*{3} .*)|(?:Starting I2P.*)|(?:\[startapp].*)))$

Without exception recognition (used for marking errors):

^(?J:(?:(?<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d+) (?:(?<level>[A-Z]+)  \[(?<module>[\w \/]+)\] (?<component>[\w.]+): (?<body>.*)|(?:(?:\^){3} \d+ similar messages omitted (?:\^){3})))|(?:(?:\*{3} .*)|(?:Starting I2P.*)|(?:\[startapp].*)))$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant