ebml-go icon indicating copy to clipboard operation
ebml-go copied to clipboard

fix: stop adding unnecessary null terminators to strings

Open voxeljorge opened this issue 3 years ago • 3 comments

When using this project with AWS Kinesis Video, Kinesis Video fails to parse the CodecID field of an MKV TrackEntry due to the fact that this package guarantees that strings will always have null terminators.

According to the EBML spec, null termination is allowed but not recommended except in the case where a field is being overwritten in place, such that the subsequent data in a string value can be ignored without fully overwriting it (in case the field is very large for example).

https://www.rfc-editor.org/rfc/rfc8794.html#terminating-elements

While the behavior in this package is technically correct, for better compatibility it is advisable not to null terminate strings unless absolutely necessary.

voxeljorge avatar Aug 05 '22 01:08 voxeljorge

Looks like some tests aren't updated

at-wat avatar Aug 09 '22 04:08 at-wat

I'm happy to go through and update more tests, do you have any feedback on the change itself though?

voxeljorge avatar Aug 12 '22 17:08 voxeljorge

I think the change itself is reasonable

at-wat avatar Aug 12 '22 23:08 at-wat

@at-wat Sorry for the long delay here but I think I've fixed the broken test, at least go test ./... passes now.

voxeljorge avatar Oct 04 '23 13:10 voxeljorge

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (9791271) 99.25% compared to head (98735d0) 99.25%. Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #172   +/-   ##
=======================================
  Coverage   99.25%   99.25%           
=======================================
  Files          24       24           
  Lines        1886     1886           
=======================================
  Hits         1872     1872           
  Misses          9        9           
  Partials        5        5           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 05 '23 02:10 codecov[bot]