Skip to content

Commit e153630

Browse files
committed
Merge branch '2.8'
2 parents c778631 + 35e255f commit e153630

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

protobuf/src/main/java/com/fasterxml/jackson/dataformat/protobuf/ProtobufGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,9 @@ protected void _encodeLongerString(String text) throws IOException
12891289

12901290
protected void _writeLengthPrefixed(byte[] data, int offset, int len) throws IOException
12911291
{
1292+
// 15-Jun-2017, tatu: [dataformats-binary#94]: need to ensure there is actually
1293+
// enough space for simple add; if not, need more checking
1294+
_ensureRoom(10); // max tag 5 bytes, ditto max length
12921295
int ptr = _writeTag(_currPtr);
12931296
ptr = ProtobufUtil.appendLengthLength(len, _currBuffer, ptr);
12941297

@@ -1781,7 +1784,7 @@ protected final void _ensureRoom(int needed) throws IOException
17811784

17821785
protected final void _ensureMore() throws IOException
17831786
{
1784-
// if not, either simple (flush), or
1787+
// if not, either simple (flush), or
17851788
final int start = _currStart;
17861789
final int currLen = _currPtr - start;
17871790

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.dataformat.protobuf.failing;
1+
package com.fasterxml.jackson.dataformat.protobuf;
22

33
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
44

@@ -31,7 +31,7 @@ public void testLongerStrings() throws Exception {
3131
ProtobufSchema schema = MAPPER.generateSchemaFor(p.getClass());
3232
byte[] proto = MAPPER.writer(schema)
3333
.writeValueAsBytes(p);
34-
assertEquals(13, proto.length);
34+
assertEquals(2 * (7995 + 3), proto.length);
3535

3636
TwoStrings result = MAPPER.readerFor(p.getClass())
3737
.with(schema)

release-notes/CREDITS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ Kenji Noguchi (knoguchi@github)
2020
* Reported #70 (protobuf), contributed fix: Can't deserialize packed repeated field
2121
(2.8.9)
2222

23+
marsqing@github
24+
25+
* Reported #85: (protobuf) _decode32Bits() bug in ProtobufParser
26+
(2.8.9)
27+
* Reported #94: (protobuf) Should _ensureRoom in ProtobufGenerator.writeString()
28+
(2.8.10)
29+
2330
baharclerode@github:
2431

2532
* Contributed #14 (avro): Add support for Avro annotations via `AvroAnnotationIntrospector`

release-notes/VERSION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Modules:
3030
#79 (proto): Fix wire type for packed arrays
3131
- [avro] Upgrade `avro-core` dep from 1.7.7 to 1.8.1
3232

33+
2.8.9.1 (not yet released)
34+
35+
#94: Should _ensureRoom in ProtobufGenerator.writeString()
36+
(reported by marsqing@github)
37+
3338
2.8.9 (12-Jun-2017)
3439

3540
#72: (protobuf) parser fails with /* comment */

0 commit comments

Comments
 (0)