Skip to content

mergeFromJsonString dumps core for a valid RFC3339 timestamp #8071

@vishal-wadhwa

Description

@vishal-wadhwa

What version of protobuf and what language are you using?
Version: 3.10
Language: PHP

What operating system (Linux, Windows, ...) and version?
Linux

What runtime / compiler are you using (e.g., python version or gcc version)
php 7.2.24

What did you do?
Steps to reproduce the behavior:

  1. Perform mergeFromJsonString on an RFC3339 compliant timestamp with a non zero minute time offset "2020-11-15T11:10:00+02:30". (Note: this works perfectly for "2020-11-15T11:10:00+02:00")

What did you expect to see
The json read correctly into \Google\Protobuf\Timestamp; as protobuf says that Timestamp (as a WKT) uses RFC3339.

What did you see instead?
Segmentation fault (core dumped)

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

If I followed along the code correctly, here the minutes are hardcoded as "00" effectively disallowing any timestamp with non-"00" offset in minutes.
https://github.com/protocolbuffers/protobuf/blob/master/php/ext/google/protobuf/php-upb.c#L6931

If I understood RFC3339 correctly, there should be no such restriction.

I could not find any existing open or closed issue which addressed this under php label, hence, I created one.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions