nokogiri 1.15.4-x86_64-linux → 1.16.0.rc1-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +11 -14
  3. data/README.md +1 -1
  4. data/dependencies.yml +9 -8
  5. data/ext/nokogiri/extconf.rb +3 -4
  6. data/ext/nokogiri/html4_sax_push_parser.c +1 -1
  7. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +23 -0
  8. data/ext/nokogiri/include/libxml2/libxml/SAX.h +0 -2
  9. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +0 -2
  10. data/ext/nokogiri/include/libxml2/libxml/c14n.h +0 -2
  11. data/ext/nokogiri/include/libxml2/libxml/dict.h +1 -0
  12. data/ext/nokogiri/include/libxml2/libxml/encoding.h +16 -14
  13. data/ext/nokogiri/include/libxml2/libxml/entities.h +4 -0
  14. data/ext/nokogiri/include/libxml2/libxml/globals.h +15 -503
  15. data/ext/nokogiri/include/libxml2/libxml/hash.h +57 -61
  16. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +2 -2
  17. data/ext/nokogiri/include/libxml2/libxml/parser.h +128 -18
  18. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +1 -0
  19. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +2 -1
  20. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +1 -0
  21. data/ext/nokogiri/include/libxml2/libxml/schematron.h +1 -0
  22. data/ext/nokogiri/include/libxml2/libxml/threads.h +4 -11
  23. data/ext/nokogiri/include/libxml2/libxml/tree.h +68 -20
  24. data/ext/nokogiri/include/libxml2/libxml/uri.h +2 -1
  25. data/ext/nokogiri/include/libxml2/libxml/valid.h +2 -0
  26. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +65 -12
  27. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +37 -8
  28. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +37 -40
  29. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +6 -0
  30. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +2 -9
  31. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +9 -0
  32. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +3 -0
  33. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +28 -43
  34. data/ext/nokogiri/include/libxml2/libxml/xpath.h +1 -1
  35. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +2 -1
  36. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +5 -4
  37. data/ext/nokogiri/include/libxslt/xsltconfig.h +4 -4
  38. data/ext/nokogiri/include/libxslt/xsltlocale.h +8 -0
  39. data/ext/nokogiri/nokogiri.h +10 -3
  40. data/ext/nokogiri/test_global_handlers.c +1 -1
  41. data/ext/nokogiri/xml_cdata.c +1 -2
  42. data/ext/nokogiri/xml_document.c +3 -3
  43. data/ext/nokogiri/xml_namespace.c +0 -4
  44. data/ext/nokogiri/xml_node.c +5 -8
  45. data/ext/nokogiri/xml_reader.c +1 -44
  46. data/ext/nokogiri/xml_relax_ng.c +1 -1
  47. data/ext/nokogiri/xml_sax_push_parser.c +1 -1
  48. data/ext/nokogiri/xml_schema.c +2 -3
  49. data/ext/nokogiri/xml_syntax_error.c +3 -3
  50. data/ext/nokogiri/xml_text.c +1 -2
  51. data/ext/nokogiri/xml_xpath_context.c +2 -5
  52. data/gumbo-parser/Makefile +15 -0
  53. data/lib/nokogiri/3.0/nokogiri.so +0 -0
  54. data/lib/nokogiri/3.1/nokogiri.so +0 -0
  55. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  56. data/lib/nokogiri/3.3/nokogiri.so +0 -0
  57. data/lib/nokogiri/css/parser_extras.rb +1 -1
  58. data/lib/nokogiri/css/xpath_visitor.rb +1 -21
  59. data/lib/nokogiri/html4/document.rb +1 -1
  60. data/lib/nokogiri/html4/encoding_reader.rb +1 -1
  61. data/lib/nokogiri/html5.rb +0 -66
  62. data/lib/nokogiri/version/constant.rb +1 -1
  63. data/lib/nokogiri/version/info.rb +6 -5
  64. data/lib/nokogiri/xml/attr.rb +2 -2
  65. data/lib/nokogiri/xml/document.rb +4 -5
  66. data/lib/nokogiri/xml/document_fragment.rb +2 -2
  67. data/lib/nokogiri/xml/namespace.rb +1 -2
  68. data/lib/nokogiri/xml/node.rb +6 -5
  69. data/lib/nokogiri/xml/node_set.rb +3 -3
  70. data/lib/nokogiri/xml/searchable.rb +3 -3
  71. data/lib/nokogiri/xml/syntax_error.rb +1 -1
  72. data/lib/nokogiri/xml.rb +1 -1
  73. data/lib/nokogiri/xslt.rb +1 -1
  74. data/lib/nokogiri.rb +1 -1
  75. metadata +7 -7
  76. data/lib/nokogiri/2.7/nokogiri.so +0 -0
@@ -29,21 +29,21 @@ XMLPUBFUN void xmlCheckVersion(int version);
29
29
  *
30
30
  * the version string like "1.2.3"
31
31
  */
32
- #define LIBXML_DOTTED_VERSION "2.11.5"
32
+ #define LIBXML_DOTTED_VERSION "2.12.3"
33
33
 
34
34
  /**
35
35
  * LIBXML_VERSION:
36
36
  *
37
37
  * the version number: 1.2.3 value is 10203
38
38
  */
39
- #define LIBXML_VERSION 21105
39
+ #define LIBXML_VERSION 21203
40
40
 
41
41
  /**
42
42
  * LIBXML_VERSION_STRING:
43
43
  *
44
44
  * the version number string, 1.2.3 value is "10203"
45
45
  */
46
- #define LIBXML_VERSION_STRING "21105"
46
+ #define LIBXML_VERSION_STRING "21203"
47
47
 
48
48
  /**
49
49
  * LIBXML_VERSION_EXTRA:
@@ -58,7 +58,7 @@ XMLPUBFUN void xmlCheckVersion(int version);
58
58
  * Macro to check that the libxml version in use is compatible with
59
59
  * the version the software has been compiled against
60
60
  */
61
- #define LIBXML_TEST_VERSION xmlCheckVersion(21105);
61
+ #define LIBXML_TEST_VERSION xmlCheckVersion(21203);
62
62
 
63
63
  #ifndef VMS
64
64
  #if 0
@@ -449,43 +449,27 @@ XMLPUBFUN void xmlCheckVersion(int version);
449
449
  #endif
450
450
 
451
451
  #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
452
- #define XML_IGNORE_FPTR_CAST_WARNINGS \
453
- _Pragma("GCC diagnostic push") \
454
- _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
455
- _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
456
- #define XML_POP_WARNINGS \
452
+ #if defined(__clang__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 800)
453
+ #define XML_IGNORE_FPTR_CAST_WARNINGS \
454
+ _Pragma("GCC diagnostic push") \
455
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
456
+ _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
457
+ #else
458
+ #define XML_IGNORE_FPTR_CAST_WARNINGS \
459
+ _Pragma("GCC diagnostic push") \
460
+ _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
461
+ #endif
462
+ #define XML_POP_WARNINGS \
457
463
  _Pragma("GCC diagnostic pop")
458
464
  #else
459
- #define XML_IGNORE_FPTR_CAST_WARNINGS
460
- #define XML_POP_WARNINGS
465
+ #define XML_IGNORE_FPTR_CAST_WARNINGS
466
+ #define XML_POP_WARNINGS
461
467
  #endif
462
468
 
463
- /** DOC_ENABLE */
464
469
  #else /* ! __GNUC__ */
465
- /**
466
- * ATTRIBUTE_UNUSED:
467
- *
468
- * Macro used to signal to GCC unused function parameters
469
- */
470
470
  #define ATTRIBUTE_UNUSED
471
- /**
472
- * LIBXML_ATTR_ALLOC_SIZE:
473
- *
474
- * Macro used to indicate to GCC this is an allocator function
475
- */
476
471
  #define LIBXML_ATTR_ALLOC_SIZE(x)
477
- /**
478
- * LIBXML_ATTR_FORMAT:
479
- *
480
- * Macro used to indicate to GCC the parameter are printf like
481
- */
482
472
  #define LIBXML_ATTR_FORMAT(fmt,args)
483
- /**
484
- * XML_DEPRECATED:
485
- *
486
- * Macro used to indicate that a function, variable, type or struct member
487
- * is deprecated.
488
- */
489
473
  #ifndef XML_DEPRECATED
490
474
  # if defined (IN_LIBXML) || !defined (_MSC_VER)
491
475
  # define XML_DEPRECATED
@@ -494,21 +478,11 @@ XMLPUBFUN void xmlCheckVersion(int version);
494
478
  # define XML_DEPRECATED __declspec(deprecated)
495
479
  # endif
496
480
  #endif
497
- /**
498
- * LIBXML_IGNORE_FPTR_CAST_WARNINGS:
499
- *
500
- * Macro used to ignore pointer cast warnings that can't be worked around.
501
- */
502
481
  #if defined (_MSC_VER) && (_MSC_VER >= 1400)
503
482
  # define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
504
483
  #else
505
484
  # define XML_IGNORE_FPTR_CAST_WARNINGS
506
485
  #endif
507
- /**
508
- * XML_POP_WARNINGS:
509
- *
510
- * Macro used to restore warnings state.
511
- */
512
486
  #ifndef XML_POP_WARNINGS
513
487
  # if defined (_MSC_VER) && (_MSC_VER >= 1400)
514
488
  # define XML_POP_WARNINGS __pragma(warning(pop))
@@ -518,6 +492,17 @@ XMLPUBFUN void xmlCheckVersion(int version);
518
492
  #endif
519
493
  #endif /* __GNUC__ */
520
494
 
495
+ #define XML_NO_ATTR
496
+
497
+ #ifdef LIBXML_THREAD_ENABLED
498
+ #define XML_DECLARE_GLOBAL(name, type, attrs) \
499
+ attrs XMLPUBFUN type *__##name(void);
500
+ #define XML_GLOBAL_MACRO(name) (*__##name())
501
+ #else
502
+ #define XML_DECLARE_GLOBAL(name, type, attrs) \
503
+ attrs XMLPUBVAR type name;
504
+ #endif
505
+
521
506
  #ifdef __cplusplus
522
507
  }
523
508
  #endif /* __cplusplus */
@@ -400,7 +400,7 @@ struct _xmlXPathParserContext {
400
400
  int xptr; /* it this an XPointer expression */
401
401
  xmlNodePtr ancestor; /* used for walking preceding axis */
402
402
 
403
- int valueFrame; /* unused */
403
+ int valueFrame; /* always zero for compatibility */
404
404
  };
405
405
 
406
406
  /************************************************************************
@@ -12,6 +12,7 @@
12
12
  #ifndef __XML_XPATH_INTERNALS_H__
13
13
  #define __XML_XPATH_INTERNALS_H__
14
14
 
15
+ #include <stdio.h>
15
16
  #include <libxml/xmlversion.h>
16
17
  #include <libxml/xpath.h>
17
18
 
@@ -297,7 +298,7 @@ XMLPUBFUN void *
297
298
  if (ctxt == NULL) return; \
298
299
  if (nargs != (x)) \
299
300
  XP_ERROR(XPATH_INVALID_ARITY); \
300
- if (ctxt->valueNr < ctxt->valueFrame + (x)) \
301
+ if (ctxt->valueNr < (x)) \
301
302
  XP_ERROR(XPATH_STACK_ERROR);
302
303
 
303
304
  /**
@@ -28,7 +28,7 @@
28
28
  extern "C" {
29
29
  #endif
30
30
 
31
- #ifdef LIBXML_XPTR_LOCS_ENABLED
31
+ #if defined(LIBXML_XPTR_LOCS_ENABLED)
32
32
  /*
33
33
  * A Location Set
34
34
  */
@@ -105,7 +105,7 @@ XML_DEPRECATED
105
105
  XMLPUBFUN void
106
106
  xmlXPtrLocationSetRemove (xmlLocationSetPtr cur,
107
107
  int val);
108
- #endif /* LIBXML_XPTR_LOCS_ENABLED */
108
+ #endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */
109
109
 
110
110
  /*
111
111
  * Functions.
@@ -117,7 +117,8 @@ XMLPUBFUN xmlXPathContextPtr
117
117
  XMLPUBFUN xmlXPathObjectPtr
118
118
  xmlXPtrEval (const xmlChar *str,
119
119
  xmlXPathContextPtr ctx);
120
- #ifdef LIBXML_XPTR_LOCS_ENABLED
120
+
121
+ #if defined(LIBXML_XPTR_LOCS_ENABLED)
121
122
  XML_DEPRECATED
122
123
  XMLPUBFUN void
123
124
  xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
@@ -128,7 +129,7 @@ XMLPUBFUN xmlNodePtr
128
129
  XML_DEPRECATED
129
130
  XMLPUBFUN void
130
131
  xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
131
- #endif /* LIBXML_XPTR_LOCS_ENABLED */
132
+ #endif /* defined(LIBXML_XPTR_LOCS_ENABLED) */
132
133
  #ifdef __cplusplus
133
134
  }
134
135
  #endif
@@ -20,21 +20,21 @@ extern "C" {
20
20
  *
21
21
  * the version string like "1.2.3"
22
22
  */
23
- #define LIBXSLT_DOTTED_VERSION "1.1.38"
23
+ #define LIBXSLT_DOTTED_VERSION "1.1.39"
24
24
 
25
25
  /**
26
26
  * LIBXSLT_VERSION:
27
27
  *
28
28
  * the version number: 1.2.3 value is 10203
29
29
  */
30
- #define LIBXSLT_VERSION 10138
30
+ #define LIBXSLT_VERSION 10139
31
31
 
32
32
  /**
33
33
  * LIBXSLT_VERSION_STRING:
34
34
  *
35
35
  * the version number string, 1.2.3 value is "10203"
36
36
  */
37
- #define LIBXSLT_VERSION_STRING "10138"
37
+ #define LIBXSLT_VERSION_STRING "10139"
38
38
 
39
39
  /**
40
40
  * LIBXSLT_VERSION_EXTRA:
@@ -132,7 +132,7 @@ extern "C" {
132
132
  #ifndef WITH_MODULES
133
133
  #define WITH_MODULES
134
134
  #endif
135
- #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x86_64-linux/libxslt/1.1.38/lib/libxslt-plugins"
135
+ #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x86_64-linux/libxslt/1.1.39/lib/libxslt-plugins"
136
136
  #endif
137
137
 
138
138
  /**
@@ -14,6 +14,10 @@
14
14
  #include <libxml/xmlstring.h>
15
15
  #include "xsltexports.h"
16
16
 
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
17
21
  XSLTPUBFUN void * XSLTCALL
18
22
  xsltNewLocale (const xmlChar *langName,
19
23
  int lowerFirst);
@@ -33,4 +37,8 @@ XSLTPUBFUN int XSLTCALL
33
37
  const xmlChar *str1,
34
38
  const xmlChar *str2);
35
39
 
40
+ #ifdef __cplusplus
41
+ }
42
+ #endif
43
+
36
44
  #endif /* __XML_XSLTLOCALE_H__ */
@@ -66,6 +66,13 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
66
66
  #define XMLNS_PREFIX "xmlns"
67
67
  #define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
68
68
 
69
+ #ifndef xmlErrorConstPtr
70
+ # if LIBXML_VERSION >= 21200
71
+ # define xmlErrorConstPtr const xmlError *
72
+ # else
73
+ # define xmlErrorConstPtr xmlError *
74
+ # endif
75
+ #endif
69
76
 
70
77
  #include <ruby.h>
71
78
  #include <ruby/st.h>
@@ -227,9 +234,9 @@ void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *hand
227
234
  void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
228
235
  xmlStructuredErrorFunc handler);
229
236
  void Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
230
- VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error);
231
- void Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error);
232
- NORETURN_DECL void Nokogiri_error_raise(void *ctx, xmlErrorPtr error);
237
+ VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error);
238
+ void Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error);
239
+ NORETURN_DECL void Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error);
233
240
  void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler,
234
241
  const char *function_name) ;
235
242
 
@@ -3,7 +3,7 @@
3
3
  static VALUE foreign_error_handler_block = Qnil;
4
4
 
5
5
  static void
6
- foreign_error_handler(void *user_data, xmlErrorPtr c_error)
6
+ foreign_error_handler(void *user_data, xmlErrorConstPtr c_error)
7
7
  {
8
8
  rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
9
9
  }
@@ -33,8 +33,7 @@ rb_xml_cdata_s_new(int argc, VALUE *argv, VALUE klass)
33
33
 
34
34
  if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
35
35
  xmlNodePtr deprecated_node_type_arg;
36
- // TODO: deprecate allowing Node
37
- NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
36
+ NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
38
37
  Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
39
38
  c_document = deprecated_node_type_arg->doc;
40
39
  } else {
@@ -337,7 +337,7 @@ read_io(VALUE klass,
337
337
  xmlSetStructuredErrorFunc(NULL, NULL);
338
338
 
339
339
  if (doc == NULL) {
340
- xmlErrorPtr error;
340
+ xmlErrorConstPtr error;
341
341
 
342
342
  xmlFreeDoc(doc);
343
343
 
@@ -383,7 +383,7 @@ read_memory(VALUE klass,
383
383
  xmlSetStructuredErrorFunc(NULL, NULL);
384
384
 
385
385
  if (doc == NULL) {
386
- xmlErrorPtr error;
386
+ xmlErrorConstPtr error;
387
387
 
388
388
  xmlFreeDoc(doc);
389
389
 
@@ -537,7 +537,7 @@ create_entity(int argc, VALUE *argv, VALUE self)
537
537
  );
538
538
 
539
539
  if (NULL == ptr) {
540
- xmlErrorPtr error = xmlGetLastError();
540
+ xmlErrorConstPtr error = xmlGetLastError();
541
541
  if (error) {
542
542
  rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
543
543
  } else {
@@ -42,7 +42,6 @@ _xml_namespace_dealloc(void *ptr)
42
42
  xmlFree(ns);
43
43
  }
44
44
 
45
- #ifdef HAVE_RB_GC_LOCATION
46
45
  static void
47
46
  _xml_namespace_update_references(void *ptr)
48
47
  {
@@ -51,9 +50,6 @@ _xml_namespace_update_references(void *ptr)
51
50
  ns->_private = (void *)rb_gc_location((VALUE)ns->_private);
52
51
  }
53
52
  }
54
- #else
55
- # define _xml_namespace_update_references 0
56
- #endif
57
53
 
58
54
  static const rb_data_type_t nokogiri_xml_namespace_type_with_dealloc = {
59
55
  .wrap_struct_name = "Nokogiri::XML::Namespace#with_dealloc",
@@ -28,7 +28,6 @@ _xml_node_mark(void *ptr)
28
28
  }
29
29
  }
30
30
 
31
- #ifdef HAVE_RB_GC_LOCATION
32
31
  static void
33
32
  _xml_node_update_references(void *ptr)
34
33
  {
@@ -38,9 +37,6 @@ _xml_node_update_references(void *ptr)
38
37
  node->_private = (void *)rb_gc_location((VALUE)node->_private);
39
38
  }
40
39
  }
41
- #else
42
- # define _xml_node_update_references 0
43
- #endif
44
40
 
45
41
  static const rb_data_type_t nokogiri_node_type = {
46
42
  .wrap_struct_name = "Nokogiri::XML::Node",
@@ -961,7 +957,7 @@ internal_subset(VALUE self)
961
957
  * - +new_parent_doc+
962
958
  * The new node's parent Document. Defaults to the this node's document.
963
959
  *
964
- * [Returns] The new Nokgiri::XML::Node
960
+ * [Returns] The new Nokogiri::XML::Node
965
961
  */
966
962
  static VALUE
967
963
  duplicate_node(int argc, VALUE *argv, VALUE self)
@@ -2058,8 +2054,7 @@ rb_xml_node_new(int argc, VALUE *argv, VALUE klass)
2058
2054
  rb_raise(rb_eArgError, "document must be a Nokogiri::XML::Node");
2059
2055
  }
2060
2056
  if (!rb_obj_is_kind_of(rb_document_node, cNokogiriXmlDocument)) {
2061
- // TODO: deprecate allowing Node
2062
- NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.");
2057
+ NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.13.0, remove in v1.17.0
2063
2058
  }
2064
2059
  Noko_Node_Get_Struct(rb_document_node, xmlNode, c_document_node);
2065
2060
 
@@ -2138,7 +2133,7 @@ process_xincludes(VALUE self, VALUE options)
2138
2133
  xmlSetStructuredErrorFunc(NULL, NULL);
2139
2134
 
2140
2135
  if (rcode < 0) {
2141
- xmlErrorPtr error;
2136
+ xmlErrorConstPtr error;
2142
2137
 
2143
2138
  error = xmlGetLastError();
2144
2139
  if (error) {
@@ -2174,6 +2169,8 @@ in_context(VALUE self, VALUE _str, VALUE _options)
2174
2169
 
2175
2170
  /* Twiddle global variable because of a bug in libxml2.
2176
2171
  * http://git.gnome.org/browse/libxml2/commit/?id=e20fb5a72c83cbfc8e4a8aa3943c6be8febadab7
2172
+ *
2173
+ * TODO: this is fixed, and HTML_PARSE_NOIMPLIED is defined, in libxml2 2.7.7
2177
2174
  */
2178
2175
  #ifndef HTML_PARSE_NOIMPLIED
2179
2176
  htmlHandleOmittedElem(0);
@@ -166,48 +166,6 @@ rb_xml_reader_namespaces(VALUE rb_reader)
166
166
  return rb_namespaces ;
167
167
  }
168
168
 
169
- /*
170
- :call-seq: attribute_nodes() → Array<Nokogiri::XML::Attr>
171
-
172
- Get the attributes of the current node as an Array of XML:Attr
173
-
174
- ⚠ This method is deprecated and unsafe to use. It will be removed in a future version of Nokogiri.
175
-
176
- See related: #attribute_hash, #attributes
177
- */
178
- static VALUE
179
- rb_xml_reader_attribute_nodes(VALUE rb_reader)
180
- {
181
- xmlTextReaderPtr c_reader;
182
- xmlNodePtr c_node;
183
- VALUE attr_nodes;
184
- int j;
185
-
186
- // TODO: deprecated, remove in Nokogiri v1.15, see https://github.com/sparklemotion/nokogiri/issues/2598
187
- // After removal, we can also remove all the "node_has_a_document" special handling from xml_node.c
188
- NOKO_WARN_DEPRECATION("Reader#attribute_nodes is deprecated and will be removed in a future version of Nokogiri. Please use Reader#attribute_hash instead.");
189
-
190
- TypedData_Get_Struct(rb_reader, xmlTextReader, &xml_reader_type, c_reader);
191
-
192
- if (! has_attributes(c_reader)) {
193
- return rb_ary_new() ;
194
- }
195
-
196
- c_node = xmlTextReaderExpand(c_reader);
197
- if (c_node == NULL) {
198
- return Qnil;
199
- }
200
-
201
- attr_nodes = noko_xml_node_attrs(c_node);
202
-
203
- /* ensure that the Reader won't be GCed as long as a node is referenced */
204
- for (j = 0 ; j < RARRAY_LEN(attr_nodes) ; j++) {
205
- rb_iv_set(rb_ary_entry(attr_nodes, j), "@reader", rb_reader);
206
- }
207
-
208
- return attr_nodes;
209
- }
210
-
211
169
  /*
212
170
  :call-seq: attribute_hash() → Hash<String ⇒ String>
213
171
 
@@ -554,7 +512,7 @@ static VALUE
554
512
  read_more(VALUE self)
555
513
  {
556
514
  xmlTextReaderPtr reader;
557
- xmlErrorPtr error;
515
+ xmlErrorConstPtr error;
558
516
  VALUE error_list;
559
517
  int ret;
560
518
 
@@ -778,7 +736,6 @@ noko_init_xml_reader(void)
778
736
  rb_define_method(cNokogiriXmlReader, "attribute", reader_attribute, 1);
779
737
  rb_define_method(cNokogiriXmlReader, "attribute_at", attribute_at, 1);
780
738
  rb_define_method(cNokogiriXmlReader, "attribute_count", attribute_count, 0);
781
- rb_define_method(cNokogiriXmlReader, "attribute_nodes", rb_xml_reader_attribute_nodes, 0);
782
739
  rb_define_method(cNokogiriXmlReader, "attribute_hash", rb_xml_reader_attribute_hash, 0);
783
740
  rb_define_method(cNokogiriXmlReader, "attributes?", attributes_eh, 0);
784
741
  rb_define_method(cNokogiriXmlReader, "base_uri", rb_xml_reader_base_uri, 0);
@@ -93,7 +93,7 @@ xml_relax_ng_parse_schema(
93
93
  xmlRelaxNGFreeParserCtxt(c_parser_context);
94
94
 
95
95
  if (NULL == c_schema) {
96
- xmlErrorPtr error = xmlGetLastError();
96
+ xmlErrorConstPtr error = xmlGetLastError();
97
97
  if (error) {
98
98
  Nokogiri_error_raise(NULL, error);
99
99
  } else {
@@ -59,7 +59,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
59
59
 
60
60
  if (xmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0)) {
61
61
  if (!(ctx->options & XML_PARSE_RECOVER)) {
62
- xmlErrorPtr e = xmlCtxtGetLastError(ctx);
62
+ xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
63
63
  Nokogiri_error_raise(NULL, e);
64
64
  }
65
65
  }
@@ -146,7 +146,7 @@ xml_schema_parse_schema(
146
146
  xmlSchemaFreeParserCtxt(c_parser_context);
147
147
 
148
148
  if (NULL == c_schema) {
149
- xmlErrorPtr error = xmlGetLastError();
149
+ xmlErrorConstPtr error = xmlGetLastError();
150
150
  if (error) {
151
151
  Nokogiri_error_raise(NULL, error);
152
152
  } else {
@@ -222,8 +222,7 @@ rb_xml_schema_s_from_document(int argc, VALUE *argv, VALUE klass)
222
222
 
223
223
  if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
224
224
  xmlNodePtr deprecated_node_type_arg;
225
- // TODO: deprecate allowing Node
226
- NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
225
+ NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
227
226
  Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
228
227
  c_document = deprecated_node_type_arg->doc;
229
228
  } else {
@@ -26,7 +26,7 @@ Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handle
26
26
  }
27
27
 
28
28
  void
29
- Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error)
29
+ Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error)
30
30
  {
31
31
  VALUE list = (VALUE)ctx;
32
32
  Check_Type(list, T_ARRAY);
@@ -34,13 +34,13 @@ Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error)
34
34
  }
35
35
 
36
36
  void
37
- Nokogiri_error_raise(void *ctx, xmlErrorPtr error)
37
+ Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error)
38
38
  {
39
39
  rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
40
40
  }
41
41
 
42
42
  VALUE
43
- Nokogiri_wrap_xml_syntax_error(xmlErrorPtr error)
43
+ Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error)
44
44
  {
45
45
  VALUE msg, e, klass;
46
46
 
@@ -28,8 +28,7 @@ rb_xml_text_s_new(int argc, VALUE *argv, VALUE klass)
28
28
 
29
29
  if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
30
30
  xmlNodePtr deprecated_node_type_arg;
31
- // TODO: deprecate allowing Node
32
- NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
31
+ NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
33
32
  Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
34
33
  c_document = deprecated_node_type_arg->doc;
35
34
  } else {
@@ -321,11 +321,8 @@ handler_lookup(void *data, const xmlChar *c_name, const xmlChar *c_ns_uri)
321
321
  VALUE rb_handler = (VALUE)data;
322
322
  if (rb_respond_to(rb_handler, rb_intern((const char *)c_name))) {
323
323
  if (c_ns_uri == NULL) {
324
- NOKO_WARN_DEPRECATION(
325
- "A custom XPath or CSS handler function named '%s' is being invoked without a namespace."
326
- " Please update your query to reference this function as 'nokogiri:%s'."
327
- " Invoking custom handler functions without a namespace is deprecated and support will be removed in a future release of Nokogiri.",
328
- c_name, c_name);
324
+ NOKO_WARN_DEPRECATION("A custom XPath or CSS handler function named '%s' is being invoked without a namespace. Please update your query to reference this function as 'nokogiri:%s'. Invoking custom handler functions without a namespace is deprecated and will become an error in Nokogiri v1.17.0.",
325
+ c_name, c_name); // deprecated in v1.15.0, remove in v1.17.0
329
326
  }
330
327
  return method_caller;
331
328
  }
@@ -13,6 +13,20 @@ LDFLAGS := -pthread
13
13
 
14
14
  all: check
15
15
 
16
+ fuzzers: fuzzer-normal fuzzer-asan fuzzer-ubsan fuzzer-msan
17
+
18
+ fuzzer-normal:
19
+ ./fuzzer/build.sh
20
+
21
+ fuzzer-asan:
22
+ SANITIZER=asan ./fuzzer/build.sh
23
+
24
+ fuzzer-ubsan:
25
+ SANITIZER=ubsan ./fuzzer/build.sh
26
+
27
+ fuzzer-msan:
28
+ SANITIZER=msan ./fuzzer/build.sh
29
+
16
30
  # don't try to regenerate ragel or gperf files in CI, that should be a development-only action and
17
31
  # the generated files should be committed to SCM
18
32
  ifneq ($(CI),true)
@@ -81,6 +95,7 @@ coverage:
81
95
 
82
96
  clean:
83
97
  $(RM) -r build
98
+ $(RM) -r fuzzer/build fuzzer/src-* fuzzer/gumbo_corpus
84
99
 
85
100
  build/src/flags: | build/src
86
101
  @echo 'old_CC := $(CC)' > $@
Binary file
Binary file
Binary file
Binary file
@@ -23,7 +23,7 @@ module Nokogiri
23
23
 
24
24
  # Get the css selector in +string+ from the cache
25
25
  def [](string)
26
- return nil unless cache_on?
26
+ return unless cache_on?
27
27
 
28
28
  @mutex.synchronize { @cache[string] }
29
29
  end
@@ -302,7 +302,7 @@ module Nokogiri
302
302
  end
303
303
 
304
304
  def read_a_and_positive_b(values)
305
- op = values[2]
305
+ op = values[2].strip
306
306
  if op == "+"
307
307
  a = values[0].to_i
308
308
  b = values[3].to_i
@@ -335,25 +335,5 @@ module Nokogiri
335
335
  end
336
336
  end
337
337
  end
338
-
339
- module XPathVisitorAlwaysUseBuiltins # :nodoc:
340
- def self.new
341
- warn(
342
- "Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins is deprecated and will be removed in a future version of Nokogiri",
343
- { uplevel: 1 },
344
- )
345
- XPathVisitor.new(builtins: :always)
346
- end
347
- end
348
-
349
- module XPathVisitorOptimallyUseBuiltins # :nodoc:
350
- def self.new
351
- warn(
352
- "Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins is deprecated and will be removed in a future version of Nokogiri",
353
- { uplevel: 1 },
354
- )
355
- XPathVisitor.new(builtins: :optimal)
356
- end
357
- end
358
338
  end
359
339
  end
@@ -92,7 +92,7 @@ module Nokogiri
92
92
  title = XML::Node.new("title", self) << tnode
93
93
  if (head = at_xpath("//head"))
94
94
  head << title
95
- elsif (meta = (at_xpath("//meta[@charset]") || meta_content_type))
95
+ elsif (meta = at_xpath("//meta[@charset]") || meta_content_type)
96
96
  # better put after charset declaration
97
97
  meta.add_next_sibling(title)
98
98
  else
@@ -94,7 +94,7 @@ module Nokogiri
94
94
  # no support for a call without len
95
95
 
96
96
  unless @firstchunk
97
- (@firstchunk = @io.read(len)) || (return nil)
97
+ (@firstchunk = @io.read(len)) || return
98
98
 
99
99
  # This implementation expects that the first call from
100
100
  # htmlReadIO() is made with a length long enough (~1KB) to