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

Remove support for future script macros #1871

Merged
merged 1 commit into from Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Manifest.txt
Expand Up @@ -234,3 +234,4 @@ lib/xercesImpl.jar
lib/xml-apis.jar
lib/xsd/xmlparser/nokogiri.rb
patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
patches/libxml2/0002-Remove-script-macro-support.patch
40 changes: 40 additions & 0 deletions patches/libxml2/0002-Remove-script-macro-support.patch
@@ -0,0 +1,40 @@
From 27e4aa8d885e47a296ea78d114dbbe8fc7aa3508 Mon Sep 17 00:00:00 2001
From: Kevin Solorio <soloriok@gmail.com>
Date: Fri, 1 Feb 2019 14:32:42 -0800
Subject: [PATCH] Revert-support-html-h-b-7-1

---
entities.c | 17 -----------------
1 file changed, 17 deletions(-)

diff --git a/entities.c b/entities.c
index 43549bc5..82652f6d 100644
--- a/entities.c
+++ b/entities.c
@@ -623,23 +623,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
*out++ = 't';
*out++ = ';';
} else if (*cur == '&') {
- /*
- * Special handling of &{...} construct from HTML 4, see
- * http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1
- */
- if (html && attr && (cur[1] == '{') &&
- (strchr((const char *) cur, '}'))) {
- while (*cur != '}') {
- *out++ = *cur++;
- indx = out - buffer;
- if (indx + 100 > buffer_size) {
- growBufferReentrant();
- out = &buffer[indx];
- }
- }
- *out++ = *cur++;
- continue;
- }
*out++ = '&';
*out++ = 'a';
*out++ = 'm';
--
2.16.2

19 changes: 19 additions & 0 deletions test/html/test_attributes_do_not_support_macros.rb
@@ -0,0 +1,19 @@
require "helper"

module Nokogiri
module HTML
class TestAttributesDoNotSupportMacros < Nokogiri::TestCase
unless Nokogiri::VersionInfo.instance.libxml2? && Nokogiri::VersionInfo.instance.libxml2_using_system?

def test_attribute_macros_are_escaped
html = "<p><i for=\"&{<test>}\"></i></p>"
document = Nokogiri::HTML::Document.new
nodes = document.parse(html)

assert_equal "<p><i for=\"&amp;{&lt;test&gt;}\"></i></p>", nodes[0].to_s
end

end
end
end
end