After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786267 - Arbitrary errors "switching encoding : no input " generated by various functions
Arbitrary errors "switching encoding : no input " generated by various functions
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: parser
git master
Other Mac OS
: Normal normal
: ---
Assigned To: Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2017-08-14 05:59 UTC by Michael Paquier
Modified: 2017-08-21 12:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Regression diffs generated by PostgreSQL (11.39 KB, patch)
2017-08-14 05:59 UTC, Michael Paquier
none Details | Review
Fix regression of libxml2 error stack. (579 bytes, patch)
2017-08-15 19:01 UTC, Michael Paquier
none Details | Review

Description Michael Paquier 2017-08-14 05:59:58 UTC
Created attachment 357537 [details] [review]
Regression diffs generated by PostgreSQL

When running the regression tests of PostgreSQL with libxml2, I am getting many errors using the latest git master, like the following which invokes xmlCtxtReadDoc() using the XML parser, which creates additional error messages on top of the original ones of the stack:
! DETAIL:  line 1: switching encoding : no input                                                                                                                                                    

I have originally seen the error using ArchLinux package 2.9.4+96+gfb56f80e-1 which is based on commit fb56f80e of upstream libxml2, and the errors get away by using 2.9.4+4+g3169602-1, which is based on 3169602.

Bisecting manually this issue, I have found that the culprit commit is that one:
commit 46dc989080d5d6b7854de8fb3cb3de55ecbf0621
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Date:   Thu Jun 8 02:24:56 2017 +0200

    Don't switch encoding for internal parameter entities
   
    This is only needed for external entities. Trying to switch the encoding
    for internal entities could also cause a memory leak in recovery mode.

I don't know much libxml2 code to draw a conclusion by myself, so input would be welcome.
Comment 1 Nick Wellnhofer 2017-08-15 14:22:31 UTC
I guess this is caused by the second part of my commit. Can you try to revert only the change to parserInternals.c and see if it helps?
Comment 2 Michael Paquier 2017-08-15 19:01:42 UTC
Created attachment 357669 [details] [review]
Fix regression of libxml2 error stack.
Comment 3 Michael Paquier 2017-08-15 19:02:38 UTC
(In reply to Nick Wellnhofer from comment #1)
> I guess this is caused by the second part of my commit. Can you try to
> revert only the change to parserInternals.c and see if it helps?

If I use the patch of comment #2 the regression goes away.
Comment 5 Michael Paquier 2017-08-21 12:26:07 UTC
(In reply to Nick Wellnhofer from comment #4)
> Fixed with
> https://git.gnome.org/browse/libxml2/commit/
> ?id=3aca7f31cb9901dc3af449e08dda647898bfc1fe

Thanks for pushing a fix.