Skip to content

IOError on opening some WOFF2 files #6

Description

@afoster

Hi,

I'm seeing the following error when opening some WOFF2 files:

2.4.0-fostertype :001 > require 'woff'
 => true 

2.4.0-fostertype :002 > woff = WOFF::Builder.new('/path/to/Font.woff2')
 => #<WOFF::Builder:0x000000013cc9f8 @location="/path/to/Font.woff2"> 

2.4.0-fostertype :003 > woff.font_with_metadata
IOError: data truncated
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/io.rb:315:in `read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/io.rb:276:in `readbytes'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/string.rb:118:in `read_and_return_value'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/base_primitive.rb:129:in `do_read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/struct.rb:139:in `block in do_read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/struct.rb:139:in `each'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/struct.rb:139:in `do_read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/base.rb:147:in `block in read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/base.rb:254:in `start_read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/base.rb:145:in `read'
	from /Users/andy/.rvm/gems/ruby-2.4.0-fostertype/gems/bindata-2.4.1/lib/bindata/base.rb:21:in `read'
	from /Users/andy/projects/github/woff-rb/lib/woff/file.rb:38:in `read'
	from /Users/andy/projects/github/woff-rb/lib/woff/builder.rb:82:in `data'
	from /Users/andy/projects/github/woff-rb/lib/woff/builder.rb:18:in `font_with_metadata'
	from (irb):6
	from /Users/andy/.rvm/rubies/ruby-2.4.0-fostertype/bin/irb:11:in `<main>'

Any idea what might cause this behaviour?

Also, I'm interested in helping out on woff2 writing support if that's of interest.

Thanks, Andy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions