SafeConstructor ignores LoaderOptions setCodePointLimit()

Issue #570 resolved
Robert Patrick created an issue

We are using SnakeYAML 1.33 in our WebLogic Deploy Tooling project and it is working fine. Since we are not using custom classes, we would like to switch to the SafeConstructor. However, when we do this, our unit test that tests the ability to set the code points limit by parsing a large document fails with the following error, which tells me that the unit test’s value of 20000000 is being ignored.

The incoming YAML document exceeds the limit: 3145728 code points.

Comments (9)

  1. Robert Patrick reporter

    As you can see in the debugger, the loaderOptions object that is passed into the SafeConstructor has the 20 million code points limit but the resulting parser object has the default code points limit. If I examine the constructor element of the parser object, I also see that the Safe Constructor object has the 20 million code point limit set.

  2. Robert Patrick reporter

    It looks like this issue has already been addressed in master. Unfortunately for us, we are stuck needing to support JDK7 and the code in master appears to have dropped support for JDK7. Any chance of a 1.34 release with JDK7 support? 🙏

  3. Robert Patrick reporter

    @Andrey Somov That did the trick! Thanks so much. Will keep my eye out for the next release.

  4. Log in to comment