psych 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/ext/psych/yaml/api.c +38 -15
- data/ext/psych/yaml/config.h +4 -4
- data/ext/psych/yaml/emitter.c +7 -7
- data/ext/psych/yaml/loader.c +18 -3
- data/ext/psych/yaml/parser.c +1 -1
- data/ext/psych/yaml/reader.c +3 -3
- data/ext/psych/yaml/scanner.c +8 -6
- data/ext/psych/yaml/writer.c +1 -1
- data/ext/psych/yaml/yaml_private.h +5 -2
- data/lib/psych.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e0438e0f11c78efb5dedbb0f0e8f727d836658
|
4
|
+
data.tar.gz: f580bcc3ef9f64d36a7874c4142a3ee93468e83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb94e783648d0e138b975ee924630a9142904175add0314cdf0a8f963be80ccdb0cadd6fc540edeb009be04db05b091b7c915427d82af64687cb8660bac03105
|
7
|
+
data.tar.gz: 9bd7dbafd37f191394e492c0ad45652085be2577b64c467a997164d6d8424be48cec092768ce74dd2a35c48b320f97d54c7c42afffa81b3c19160c3cfdf097f3
|
data/CHANGELOG.rdoc
CHANGED
data/ext/psych/yaml/api.c
CHANGED
@@ -822,6 +822,7 @@ yaml_scalar_event_initialize(yaml_event_t *event,
|
|
822
822
|
yaml_char_t *anchor_copy = NULL;
|
823
823
|
yaml_char_t *tag_copy = NULL;
|
824
824
|
yaml_char_t *value_copy = NULL;
|
825
|
+
size_t value_length;
|
825
826
|
|
826
827
|
assert(event); /* Non-NULL event object is expected. */
|
827
828
|
assert(value); /* Non-NULL anchor is expected. */
|
@@ -839,16 +840,19 @@ yaml_scalar_event_initialize(yaml_event_t *event,
|
|
839
840
|
}
|
840
841
|
|
841
842
|
if (length < 0) {
|
842
|
-
|
843
|
+
value_length = strlen((char *)value);
|
844
|
+
}
|
845
|
+
else {
|
846
|
+
value_length = (size_t)length;
|
843
847
|
}
|
844
848
|
|
845
|
-
if (!yaml_check_utf8(value,
|
846
|
-
value_copy = yaml_malloc(
|
849
|
+
if (!yaml_check_utf8(value, value_length)) goto error;
|
850
|
+
value_copy = yaml_malloc(value_length+1);
|
847
851
|
if (!value_copy) goto error;
|
848
|
-
memcpy(value_copy, value,
|
849
|
-
value_copy[
|
852
|
+
memcpy(value_copy, value, value_length);
|
853
|
+
value_copy[value_length] = '\0';
|
850
854
|
|
851
|
-
SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy,
|
855
|
+
SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, value_length,
|
852
856
|
plain_implicit, quoted_implicit, style, mark, mark);
|
853
857
|
|
854
858
|
return 1;
|
@@ -1202,6 +1206,8 @@ yaml_document_add_scalar(yaml_document_t *document,
|
|
1202
1206
|
yaml_char_t *tag_copy = NULL;
|
1203
1207
|
yaml_char_t *value_copy = NULL;
|
1204
1208
|
yaml_node_t node;
|
1209
|
+
size_t value_length;
|
1210
|
+
ptrdiff_t ret;
|
1205
1211
|
|
1206
1212
|
assert(document); /* Non-NULL document object is expected. */
|
1207
1213
|
assert(value); /* Non-NULL value is expected. */
|
@@ -1215,19 +1221,26 @@ yaml_document_add_scalar(yaml_document_t *document,
|
|
1215
1221
|
if (!tag_copy) goto error;
|
1216
1222
|
|
1217
1223
|
if (length < 0) {
|
1218
|
-
|
1224
|
+
value_length = strlen((char *)value);
|
1225
|
+
}
|
1226
|
+
else {
|
1227
|
+
value_length = (size_t)length;
|
1219
1228
|
}
|
1220
1229
|
|
1221
|
-
if (!yaml_check_utf8(value,
|
1222
|
-
value_copy = yaml_malloc(
|
1230
|
+
if (!yaml_check_utf8(value, value_length)) goto error;
|
1231
|
+
value_copy = yaml_malloc(value_length+1);
|
1223
1232
|
if (!value_copy) goto error;
|
1224
|
-
memcpy(value_copy, value,
|
1225
|
-
value_copy[
|
1233
|
+
memcpy(value_copy, value, value_length);
|
1234
|
+
value_copy[value_length] = '\0';
|
1226
1235
|
|
1227
|
-
SCALAR_NODE_INIT(node, tag_copy, value_copy,
|
1236
|
+
SCALAR_NODE_INIT(node, tag_copy, value_copy, value_length, style, mark, mark);
|
1228
1237
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1229
1238
|
|
1230
|
-
|
1239
|
+
ret = document->nodes.top - document->nodes.start;
|
1240
|
+
#if PTRDIFF_MAX > INT_MAX
|
1241
|
+
if (ret > INT_MAX) goto error;
|
1242
|
+
#endif
|
1243
|
+
return (int)ret;
|
1231
1244
|
|
1232
1245
|
error:
|
1233
1246
|
yaml_free(tag_copy);
|
@@ -1255,6 +1268,7 @@ yaml_document_add_sequence(yaml_document_t *document,
|
|
1255
1268
|
yaml_node_item_t *top;
|
1256
1269
|
} items = { NULL, NULL, NULL };
|
1257
1270
|
yaml_node_t node;
|
1271
|
+
ptrdiff_t ret;
|
1258
1272
|
|
1259
1273
|
assert(document); /* Non-NULL document object is expected. */
|
1260
1274
|
|
@@ -1272,7 +1286,11 @@ yaml_document_add_sequence(yaml_document_t *document,
|
|
1272
1286
|
style, mark, mark);
|
1273
1287
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1274
1288
|
|
1275
|
-
|
1289
|
+
ret = document->nodes.top - document->nodes.start;
|
1290
|
+
#if PTRDIFF_MAX > INT_MAX
|
1291
|
+
if (ret > INT_MAX) goto error;
|
1292
|
+
#endif
|
1293
|
+
return (int)ret;
|
1276
1294
|
|
1277
1295
|
error:
|
1278
1296
|
STACK_DEL(&context, items);
|
@@ -1300,6 +1318,7 @@ yaml_document_add_mapping(yaml_document_t *document,
|
|
1300
1318
|
yaml_node_pair_t *top;
|
1301
1319
|
} pairs = { NULL, NULL, NULL };
|
1302
1320
|
yaml_node_t node;
|
1321
|
+
ptrdiff_t ret;
|
1303
1322
|
|
1304
1323
|
assert(document); /* Non-NULL document object is expected. */
|
1305
1324
|
|
@@ -1317,7 +1336,11 @@ yaml_document_add_mapping(yaml_document_t *document,
|
|
1317
1336
|
style, mark, mark);
|
1318
1337
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1319
1338
|
|
1320
|
-
|
1339
|
+
ret = document->nodes.top - document->nodes.start;
|
1340
|
+
#if PTRDIFF_MAX > INT_MAX
|
1341
|
+
if (ret > INT_MAX) goto error;
|
1342
|
+
#endif
|
1343
|
+
return (int)ret;
|
1321
1344
|
|
1322
1345
|
error:
|
1323
1346
|
STACK_DEL(&context, pairs);
|
data/ext/psych/yaml/config.h
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
2
|
#define PACKAGE_NAME "yaml"
|
3
3
|
#define PACKAGE_TARNAME "yaml"
|
4
|
-
#define PACKAGE_VERSION "0.1.
|
5
|
-
#define PACKAGE_STRING "yaml 0.1.
|
4
|
+
#define PACKAGE_VERSION "0.1.5"
|
5
|
+
#define PACKAGE_STRING "yaml 0.1.5"
|
6
6
|
#define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component libyaml"
|
7
7
|
#define PACKAGE_URL ""
|
8
8
|
#define YAML_VERSION_MAJOR 0
|
9
9
|
#define YAML_VERSION_MINOR 1
|
10
|
-
#define YAML_VERSION_PATCH
|
11
|
-
#define YAML_VERSION_STRING "0.1.
|
10
|
+
#define YAML_VERSION_PATCH 5
|
11
|
+
#define YAML_VERSION_STRING "0.1.5"
|
data/ext/psych/yaml/emitter.c
CHANGED
@@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
|
|
221
221
|
|
222
222
|
static int
|
223
223
|
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
|
224
|
-
char *indicator, int need_whitespace,
|
224
|
+
const char *indicator, int need_whitespace,
|
225
225
|
int is_whitespace, int is_indention);
|
226
226
|
|
227
227
|
static int
|
@@ -517,7 +517,7 @@ yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
|
|
517
517
|
if (emitter->best_width < 0) {
|
518
518
|
emitter->best_width = INT_MAX;
|
519
519
|
}
|
520
|
-
|
520
|
+
|
521
521
|
if (!emitter->line_break) {
|
522
522
|
emitter->line_break = YAML_LN_BREAK;
|
523
523
|
}
|
@@ -607,7 +607,7 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
|
|
607
607
|
if (!yaml_emitter_write_indent(emitter))
|
608
608
|
return 0;
|
609
609
|
}
|
610
|
-
|
610
|
+
|
611
611
|
if (event->data.document_start.tag_directives.start
|
612
612
|
!= event->data.document_start.tag_directives.end) {
|
613
613
|
implicit = 0;
|
@@ -721,7 +721,7 @@ yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
|
|
721
721
|
}
|
722
722
|
|
723
723
|
/*
|
724
|
-
*
|
724
|
+
*
|
725
725
|
* Expect a flow item node.
|
726
726
|
*/
|
727
727
|
|
@@ -1402,7 +1402,7 @@ yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
|
|
1402
1402
|
{
|
1403
1403
|
size_t anchor_length;
|
1404
1404
|
yaml_string_t string;
|
1405
|
-
|
1405
|
+
|
1406
1406
|
anchor_length = strlen((char *)anchor);
|
1407
1407
|
STRING_ASSIGN(string, anchor, anchor_length);
|
1408
1408
|
|
@@ -1784,7 +1784,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
|
|
1784
1784
|
|
1785
1785
|
static int
|
1786
1786
|
yaml_emitter_write_indicator(yaml_emitter_t *emitter,
|
1787
|
-
char *indicator, int need_whitespace,
|
1787
|
+
const char *indicator, int need_whitespace,
|
1788
1788
|
int is_whitespace, int is_indention)
|
1789
1789
|
{
|
1790
1790
|
size_t indicator_length;
|
@@ -2178,7 +2178,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
|
|
2178
2178
|
yaml_string_t string)
|
2179
2179
|
{
|
2180
2180
|
char indent_hint[2];
|
2181
|
-
char *chomp_hint = NULL;
|
2181
|
+
const char *chomp_hint = NULL;
|
2182
2182
|
|
2183
2183
|
if (IS_SPACE(string) || IS_BREAK(string))
|
2184
2184
|
{
|
data/ext/psych/yaml/loader.c
CHANGED
@@ -283,6 +283,7 @@ static int
|
|
283
283
|
yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
|
284
284
|
{
|
285
285
|
yaml_node_t node;
|
286
|
+
ptrdiff_t node_index;
|
286
287
|
int index;
|
287
288
|
yaml_char_t *tag = first_event->data.scalar.tag;
|
288
289
|
|
@@ -300,7 +301,11 @@ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
|
|
300
301
|
|
301
302
|
if (!PUSH(parser, parser->document->nodes, node)) goto error;
|
302
303
|
|
303
|
-
|
304
|
+
node_index = parser->document->nodes.top - parser->document->nodes.start;
|
305
|
+
#if PTRDIFF_MAX > INT_MAX
|
306
|
+
if (node_index > INT_MAX) goto error;
|
307
|
+
#endif
|
308
|
+
index = (int)node_index;
|
304
309
|
|
305
310
|
if (!yaml_parser_register_anchor(parser, index,
|
306
311
|
first_event->data.scalar.anchor)) return 0;
|
@@ -329,6 +334,7 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
|
|
329
334
|
yaml_node_item_t *top;
|
330
335
|
} items = { NULL, NULL, NULL };
|
331
336
|
int index, item_index;
|
337
|
+
ptrdiff_t node_index;
|
332
338
|
yaml_char_t *tag = first_event->data.sequence_start.tag;
|
333
339
|
|
334
340
|
if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
|
@@ -347,7 +353,11 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
|
|
347
353
|
|
348
354
|
if (!PUSH(parser, parser->document->nodes, node)) goto error;
|
349
355
|
|
350
|
-
|
356
|
+
node_index = parser->document->nodes.top - parser->document->nodes.start;
|
357
|
+
#if PTRDIFF_MAX > INT_MAX
|
358
|
+
if (node_index > INT_MAX) goto error;
|
359
|
+
#endif
|
360
|
+
index = (int)node_index;
|
351
361
|
|
352
362
|
if (!yaml_parser_register_anchor(parser, index,
|
353
363
|
first_event->data.sequence_start.anchor)) return 0;
|
@@ -391,6 +401,7 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
|
|
391
401
|
yaml_node_pair_t *top;
|
392
402
|
} pairs = { NULL, NULL, NULL };
|
393
403
|
int index;
|
404
|
+
ptrdiff_t node_index;
|
394
405
|
yaml_node_pair_t pair;
|
395
406
|
yaml_char_t *tag = first_event->data.mapping_start.tag;
|
396
407
|
|
@@ -410,7 +421,11 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
|
|
410
421
|
|
411
422
|
if (!PUSH(parser, parser->document->nodes, node)) goto error;
|
412
423
|
|
413
|
-
|
424
|
+
node_index = parser->document->nodes.top - parser->document->nodes.start;
|
425
|
+
#if PTRDIFF_MAX > INT_MAX
|
426
|
+
if (node_index > INT_MAX) goto error;
|
427
|
+
#endif
|
428
|
+
index = (int)node_index;
|
414
429
|
|
415
430
|
if (!yaml_parser_register_anchor(parser, index,
|
416
431
|
first_event->data.mapping_start.anchor)) return 0;
|
data/ext/psych/yaml/parser.c
CHANGED
@@ -1295,7 +1295,7 @@ yaml_parser_process_directives(yaml_parser_t *parser,
|
|
1295
1295
|
token = PEEK_TOKEN(parser);
|
1296
1296
|
if (!token) goto error;
|
1297
1297
|
}
|
1298
|
-
|
1298
|
+
|
1299
1299
|
for (default_tag_directive = default_tag_directives;
|
1300
1300
|
default_tag_directive->handle; default_tag_directive++) {
|
1301
1301
|
if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
|
data/ext/psych/yaml/reader.c
CHANGED
@@ -52,7 +52,7 @@ yaml_parser_determine_encoding(yaml_parser_t *parser)
|
|
52
52
|
{
|
53
53
|
/* Ensure that we had enough bytes in the raw buffer. */
|
54
54
|
|
55
|
-
while (!parser->eof
|
55
|
+
while (!parser->eof
|
56
56
|
&& parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
|
57
57
|
if (!yaml_parser_update_raw_buffer(parser)) {
|
58
58
|
return 0;
|
@@ -295,7 +295,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
|
|
295
295
|
parser->offset, value);
|
296
296
|
|
297
297
|
break;
|
298
|
-
|
298
|
+
|
299
299
|
case YAML_UTF16LE_ENCODING:
|
300
300
|
case YAML_UTF16BE_ENCODING:
|
301
301
|
|
@@ -318,7 +318,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
|
|
318
318
|
*
|
319
319
|
* The following formulas are used for decoding
|
320
320
|
* and encoding characters using surrogate pairs:
|
321
|
-
*
|
321
|
+
*
|
322
322
|
* U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
|
323
323
|
* U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
|
324
324
|
* W1 = 110110yyyyyyyyyy
|
data/ext/psych/yaml/scanner.c
CHANGED
@@ -762,7 +762,7 @@ yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
|
|
762
762
|
}
|
763
763
|
|
764
764
|
/* Fetch the next token from the queue. */
|
765
|
-
|
765
|
+
|
766
766
|
*token = DEQUEUE(parser, parser->tokens);
|
767
767
|
parser->token_available = 0;
|
768
768
|
parser->tokens_parsed ++;
|
@@ -1121,7 +1121,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
|
|
1121
1121
|
yaml_simple_key_t simple_key;
|
1122
1122
|
simple_key.possible = 1;
|
1123
1123
|
simple_key.required = required;
|
1124
|
-
simple_key.token_number =
|
1124
|
+
simple_key.token_number =
|
1125
1125
|
parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head);
|
1126
1126
|
simple_key.mark = parser->mark;
|
1127
1127
|
|
@@ -1207,7 +1207,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
|
|
1207
1207
|
* Push the current indentation level to the stack and set the new level
|
1208
1208
|
* the current column is greater than the indentation level. In this case,
|
1209
1209
|
* append or insert the specified token into the token queue.
|
1210
|
-
*
|
1210
|
+
*
|
1211
1211
|
*/
|
1212
1212
|
|
1213
1213
|
static int
|
@@ -1231,12 +1231,14 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
|
|
1231
1231
|
if (!PUSH(parser, parser->indents, parser->indent))
|
1232
1232
|
return 0;
|
1233
1233
|
|
1234
|
+
#if PTRDIFF_MAX > INT_MAX
|
1234
1235
|
if (column > INT_MAX) {
|
1235
1236
|
parser->error = YAML_MEMORY_ERROR;
|
1236
1237
|
return 0;
|
1237
1238
|
}
|
1239
|
+
#endif
|
1238
1240
|
|
1239
|
-
parser->indent = column;
|
1241
|
+
parser->indent = (int)column;
|
1240
1242
|
|
1241
1243
|
/* Create a token and insert it into the queue. */
|
1242
1244
|
|
@@ -1945,7 +1947,7 @@ yaml_parser_scan_to_next_token(yaml_parser_t *parser)
|
|
1945
1947
|
*
|
1946
1948
|
* - in the flow context;
|
1947
1949
|
* - in the block context, but not at the beginning of the line or
|
1948
|
-
* after '-', '?', or ':' (complex value).
|
1950
|
+
* after '-', '?', or ':' (complex value).
|
1949
1951
|
*/
|
1950
1952
|
|
1951
1953
|
if (!CACHE(parser, 1)) return 0;
|
@@ -3011,7 +3013,7 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
|
|
3011
3013
|
*indent = 1;
|
3012
3014
|
}
|
3013
3015
|
|
3014
|
-
return 1;
|
3016
|
+
return 1;
|
3015
3017
|
}
|
3016
3018
|
|
3017
3019
|
/*
|
data/ext/psych/yaml/writer.c
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
#ifdef RUBY_EXTCONF_H
|
2
|
+
#include RUBY_EXTCONF_H
|
3
|
+
#endif
|
1
4
|
|
2
5
|
#if HAVE_CONFIG_H
|
3
6
|
#include <config.h>
|
@@ -239,9 +242,9 @@ yaml_string_join(
|
|
239
242
|
(string).pointer[offset] <= (yaml_char_t) 'f') ? \
|
240
243
|
((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \
|
241
244
|
((string).pointer[offset] - (yaml_char_t) '0'))
|
242
|
-
|
245
|
+
|
243
246
|
#define AS_HEX(string) AS_HEX_AT((string),0)
|
244
|
-
|
247
|
+
|
245
248
|
/*
|
246
249
|
* Check if the character is ASCII.
|
247
250
|
*/
|
data/lib/psych.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psych
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|