-
-
Notifications
You must be signed in to change notification settings - Fork 18
Panic when loading hocon document, for entering unreachable code #26
Comments
I tried cloning master locally and putting in a debug
This UUID does not appear anywhere in my configs. Modified code: impl std::hash::Hash for HoconValue {
fn hash<H>(&self, state: &mut H)
where
H: std::hash::Hasher,
{
match self {
HoconValue::Integer(i) => i.hash(state),
HoconValue::String(s) => s.hash(state),
_ => {
println!("{:?}", self);
unreachable!()
}
};
}
} |
Hello, and thank you for reporting this ! I added a few debug prints on branch unreachable-null, could you try it ? Those
Parsing this will print the following:
lines before |
I haven't yet found the source of the original error, but I did find another situation that panics: DefaultParsers = ${DefaultParsers}${WazuhParsers} Just loading a file with this single line causes it to panic with a stack overflow.
|
I have found a simplified example that causes a different unreachable code issue:
parsers_wazuh.conf
Causes:
// These cases should have been replaced during substitution
// and not exist anymore at this point
HoconValue::Temp => unreachable!(),
HoconValue::EmptyObject => unreachable!(),
HoconValue::EmptyArray => unreachable!(),
HoconValue::PathSubstitutionInParent(_) => unreachable!(), // PANICS HERE
HoconValue::ToConcatToArray { .. } => unreachable!(), Note that this only seems to happen if I'm including it from a separate file, not if it is all in one file. EDIT: the value in the |
…h a substitution #26 alsoo fix case for stack overflow when substituting a value that hasn't been defined in some cases
I pushed a fix for those two issues to master, and also a fix to #27 that I found while trying stuff... Could you test master if it's better for you ? |
This seems to have resolved all three panics, thank you! I now get I am still getting some strange behavior. Maybe this is normal for hocon or this library, though.
Gets me:
and this:
Gets me:
|
should be fixed also, that now gets
|
Much better!
now gives I'm not sure if that is normal for it to add that empty string in the middle. |
You're right, the |
Thanks, that one works now. I'm still getting
from
Not sure if that's normal. I would have thought that both would be "null", or both would be an empty string "". |
src/main.rs
Panics when it loads the document (run in release mode, as debug mode doesn't seem to ever finish loading):
I unfortunately cannot give you the document(s) that cause this, as they are proprietary. I also do not have a minimum working example, as I have no idea what triggers it yet. The file being loaded includes many other files, and exercises many hocon features. In total, it's almost 100,000 lines of hocon, so it may take me a while to find a minimum reproducible example.
It seems to be hitting the
unreachable()
insrc/internals/value.rs
:Tested with hocon v0.3.5
The text was updated successfully, but these errors were encountered: