Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
libyaml
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
libraries
libyaml
Commits
c7ff5042f966
Commit
c7ff5042f966
authored
7 years ago
by
Roger Peppe
Browse files
Options
Downloads
Patches
Plain Diff
Remove need for PTRDIFF_MAX
It's just as easy to calculate the maximum value directly.
parent
170463793d56
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/reader.c
+3
-3
3 additions, 3 deletions
src/reader.c
src/yaml_private.h
+11
-22
11 additions, 22 deletions
src/yaml_private.h
with
14 additions
and
25 deletions
src/reader.c
+
3
−
3
View file @
c7ff5042
...
...
@@ -460,5 +460,5 @@
}
if
(
parser
->
offset
>=
PTRDIFF_MAX
)
if
(
parser
->
offset
>=
MAX_FILE_SIZE
)
{
return
yaml_parser_set_reader_error
(
parser
,
"input is too long"
,
...
...
@@ -464,5 +464,6 @@
return
yaml_parser_set_reader_error
(
parser
,
"input is too long"
,
PTRDIFF_MAX
,
-
1
);
parser
->
offset
,
-
1
);
}
return
1
;
}
...
...
@@ -466,4 +467,3 @@
return
1
;
}
This diff is collapsed.
Click to expand it.
src/yaml_private.h
+
11
−
22
View file @
c7ff5042
...
...
@@ -8,28 +8,6 @@
#include
<limits.h>
#include
<stddef.h>
#ifndef _MSC_VER
#if defined(__sun) || defined(__sun__)
#include
<sys/inttypes.h>
#define PTRDIFF_MAX INT_MAX
#else
#include
<stdint.h>
#ifndef PTRDIFF_MAX
/* gcc on HP-UX */
#ifdef _LP64
#define PTRDIFF_MAX 0x7FFFFFFFFFFFFFFFLL
#else
#define PTRDIFF_MAX 0x7FFFFFFFL
#endif
#endif
#endif
#else
#ifdef _WIN64
#define PTRDIFF_MAX _I64_MAX
#else
#define PTRDIFF_MAX INT_MAX
#endif
#endif
/*
* Memory management.
*/
...
...
@@ -89,6 +67,17 @@
#define OUTPUT_RAW_BUFFER_SIZE (OUTPUT_BUFFER_SIZE*2+2)
/*
* The maximum size of a YAML input file.
* This used to be PTRDIFF_MAX, but that's not entirely portable
* because stdint.h isn't available on all platforms.
* It is not entirely clear why this isn't the maximum value
* that can fit into the parser->offset field.
*/
#define MAX_FILE_SIZE (~(size_t)0 / 2)
/*
* The size of other stacks and queues.
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment