Skip to content

Commit 4c2adb5

Browse files
authored
Merge pull request #2125 from DennisHeimbigner/dmh-patches1.dmh
Patch errors
2 parents 5cd17ba + 8bbdee1 commit 4c2adb5

15 files changed

Lines changed: 325 additions & 227 deletions

File tree

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This file contains a high-level description of this package's evolution. Release
77

88
## 4.8.2 - TBD
99

10+
* [Bug Fix] Apply patches for ezxml and for selected oss-fuzz detected errors. See [Github #2125](https://github.com/Unidata/netcdf-c/pull/2125).
1011
* [Bug Fix] Ensure that internal Fortran APIs are always defined. See [Github #2098](https://github.com/Unidata/netcdf-c/pull/2098).
1112
* [Enhancement] Support filters for NCZarr. See [Github #2101](https://github.com/Unidata/netcdf-c/pull/2101)
1213
* [Bug Fix] Make PR 2075 long file name be idempotent. See [Github #2094](https://github.com/Unidata/netcdf-c/pull/2094).

include/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ nc4internal.h nctime.h nc3internal.h onstack.h ncrc.h ncauth.h \
2020
ncoffsets.h nctestserver.h nc4dispatch.h nc3dispatch.h ncexternl.h \
2121
ncpathmgr.h ncindex.h hdf4dispatch.h hdf5internal.h nc_provenance.h \
2222
hdf5dispatch.h ncmodel.h isnan.h nccrc.h ncexhash.h ncxcache.h \
23-
ncfilter.h ncjson.h
23+
ncfilter.h ncjson.h ezxml.h
2424

2525
if USE_DAP
2626
noinst_HEADERS += ncdap.h

libdap4/ezxml.h renamed to include/ezxml.h

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -57,69 +57,74 @@ struct ezxml {
5757
/* structure. For efficiency, modifies the data by adding null terminators*/
5858
/* and decoding ampersand sequences. If you don't want this, copy the data and*/
5959
/* pass in the copy. Returns NULL on failure.*/
60-
ezxml_t ezxml_parse_str(char *s, size_t len);
61-
62-
/* A wrapper for ezxml_parse_str() that accepts a file descriptor. First*/
63-
/* attempts to mem map the file. Failing that, reads the file into memory.*/
64-
/* Returns NULL on failure.*/
65-
ezxml_t ezxml_parse_fd(int fd);
66-
67-
/* a wrapper for ezxml_parse_fd() that accepts a file name*/
68-
ezxml_t ezxml_parse_file(const char *file);
69-
70-
/* Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire*/
71-
/* stream into memory and then parses it. For xml files, use ezxml_parse_file()*/
72-
/* or ezxml_parse_fd()*/
73-
ezxml_t ezxml_parse_fp(FILE *fp);
60+
ezxml_t nc_ezxml_parse_str(char *s, size_t len);
7461

7562
/* returns the first child tag (one level deeper) with the given name or NULL*/
7663
/* if not found*/
77-
ezxml_t ezxml_child(ezxml_t xml, const char *name);
64+
ezxml_t nc_ezxml_child(ezxml_t xml, const char *name);
7865

7966
/* returns the next tag of the same name in the same section and depth or NULL*/
8067
/* if not found*/
81-
#define ezxml_next(xml) ((xml) ? xml->next : NULL)
68+
#define nc_ezxml_next(xml) ((xml) ? (xml)->next : NULL)
8269

8370
/* Returns the Nth tag with the same name in the same section at the same depth*/
8471
/* or NULL if not found. An index of 0 returns the tag given.*/
85-
ezxml_t ezxml_idx(ezxml_t xml, int idx);
72+
ezxml_t nc_ezxml_idx(ezxml_t xml, int idx);
8673

8774
/* returns the name of the given tag*/
88-
#define ezxml_name(xml) ((xml) ? xml->name : NULL)
75+
#define nc_ezxml_name(xml) ((xml) ? xml->name : NULL)
8976

9077
/* returns the given tag's character content or empty string if none*/
91-
#define ezxml_txt(xml) ((xml) ? xml->txt : "")
78+
#define nc_ezxml_txt(xml) ((xml) ? xml->txt : "")
9279

9380
/* returns the value of the requested tag attribute, or NULL if not found*/
94-
const char *ezxml_attr(ezxml_t xml, const char *attr);
81+
const char *nc_ezxml_attr(ezxml_t xml, const char *attr);
9582

9683
/* Traverses the ezxml structure to retrieve a specific subtag. Takes a*/
9784
/* variable length list of tag names and indexes. The argument list must be*/
9885
/* terminated by either an index of -1 or an empty string tag name. Example: */
9986
/* title = ezxml_get(library, "shelf", 0, "book", 2, "title", -1);*/
10087
/* This retrieves the title of the 3rd book on the 1st shelf of library.*/
10188
/* Returns NULL if not found.*/
102-
ezxml_t ezxml_get(ezxml_t xml, ...);
89+
ezxml_t nc_ezxml_get(ezxml_t xml, ...);
10390

10491
/* Converts an ezxml structure back to xml. Returns a string of xml data that*/
10592
/* must be freed.*/
106-
char *ezxml_toxml(ezxml_t xml);
93+
char *nc_ezxml_toxml(ezxml_t xml);
10794

10895
/* returns a NULL terminated array of processing instructions for the given*/
10996
/* target*/
110-
const char **ezxml_pi(ezxml_t xml, const char *target);
97+
const char **nc_ezxml_pi(ezxml_t xml, const char *target);
11198

11299
/* frees the memory allocated for an ezxml structure*/
113-
void ezxml_free(ezxml_t xml);
100+
void nc_ezxml_free(ezxml_t xml);
114101

115102
/* returns parser error message or empty string if none*/
116-
const char *ezxml_error(ezxml_t xml);
103+
const char *nc_ezxml_error(ezxml_t xml);
104+
105+
const char** nc_ezxml_all_attr(ezxml_t xml, int* countp);
106+
107+
108+
#if 0
117109

118110
/* returns a new empty ezxml structure with the given root tag name*/
119-
ezxml_t ezxml_new(const char *name);
111+
ezxml_t nc_ezxml_new(const char *name);
120112

121113
/* wrapper for ezxml_new() that strdup()s name*/
122-
#define ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM)
114+
#define nc_ezxml_new_d(name) ezxml_set_flag(ezxml_new(strdup(name)), EZXML_NAMEM)
115+
116+
/* A wrapper for ezxml_parse_str() that accepts a file descriptor. First*/
117+
/* attempts to mem map the file. Failing that, reads the file into memory.*/
118+
/* Returns NULL on failure.*/
119+
ezxml_t ezxml_parse_fd(int fd);
120+
121+
/* a wrapper for ezxml_parse_fd() that accepts a file name*/
122+
ezxml_t ezxml_parse_file(const char *file);
123+
124+
/* Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire*/
125+
/* stream into memory and then parses it. For xml files, use ezxml_parse_file()*/
126+
/* or ezxml_parse_fd()*/
127+
ezxml_t ezxml_parse_fp(FILE *fp);
123128

124129
/* Adds a child tag. off is the offset of the child tag relative to the start*/
125130
/* of the parent tag's character content. Returns the child tag.*/
@@ -160,6 +165,8 @@ ezxml_t ezxml_insert(ezxml_t xml, ezxml_t dest, size_t off);
160165
/* removes a tag along with all its subtags*/
161166
#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
162167

168+
#endif /*0*/
169+
163170
#ifdef __cplusplus
164171
}
165172
#endif

libdap4/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# University Corporation for Atmospheric Research/Unidata.
55

66
# See netcdf-c/COPYRIGHT file for more info.
7-
SET(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c ezxml_extra.c ezxml.c)
7+
SET(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c)
88

99
add_library(dap4 OBJECT ${dap4_SOURCES})
1010

libdap4/Makefile.am

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ d4util.c \
3535
d4odom.c \
3636
d4cvt.c \
3737
d4debug.c \
38-
ncd4dispatch.c \
39-
ezxml_extra.c \
40-
ezxml.c
38+
ncd4dispatch.c
4139

4240
HDRS= \
4341
ncd4dispatch.h \
@@ -51,8 +49,7 @@ d4util.h \
5149
d4debug.h \
5250
d4odom.h \
5351
d4bytes.h \
54-
d4includes.h \
55-
ezxml.h
52+
d4includes.h
5653

5754
if ENABLE_DAP4
5855
if USE_NETCDF4
@@ -67,13 +64,3 @@ libdap4_la_LIBADD =
6764

6865
endif # ENABLE_DAP4
6966

70-
# Show what is needed to insert a new version of ezxml
71-
# primary fix: The original ezxml.[ch] uses '//' comments;
72-
# unpack and replace with '/*..*/'
73-
EZXML=ezxml-0.8.6.tar.gz
74-
ezxml::
75-
rm -fr ./ezxml ./ezxml.[ch] ./license.txt
76-
tar -zxf ./${EZXML}
77-
sed -e 's|//\(.*\)|/*\1*/|' <ezxml/ezxml.c >./ezxml.c
78-
sed -e 's|//\(.*\)|/*\1*/|' <ezxml/ezxml.h >./ezxml.h
79-
cp ezxml/license.txt .

0 commit comments

Comments
 (0)