Git Product home page Git Product logo

goexif2's Introduction

Hi there ๐Ÿ‘‹

I have a personal blog and landing page about myself located at xor-gate.org.

goexif2's People

Contributors

agorf avatar aykevl avatar bradfitz avatar domenipavec avatar dustin avatar edrex avatar fawick avatar fgeller avatar gsadams avatar jtolio avatar mpl avatar mr-andreas avatar op avatar pfrstg avatar porridge avatar rodaine avatar rubenv avatar rwcarlsen avatar ssoroka avatar vansante avatar vomnes avatar wathiede avatar xor-gate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

goexif2's Issues

parse3Rat2 returns NaN rather than error or 0.0

I've encountered several photos that have an exif LatLong entry (encoded as rationals) where one or both of the coordinates have numerator == denominator == 0. In this case exif.LatLong() returns NaN for the offending point(s).

If would be helpful if this case were handled more directly. Perhaps you could return an error in any case where the denominator is 0. Additionally, you could interpret any rational with a 0 numerator as 0.0.

Crash when exif.MakerNote is empty in Parse (Nikon) + Code to fix it

Crash when exif.MakerNote is empty in Parse (Nikon) :

panic: runtime error: slice bounds out of range

goroutine 19 [running]:
github.com/xor-gate/goexif2/mknote.(*nikonV3).Parse(0x1443ec0, 0xc420150ea0, 0x0, 0x0)
	/Users/vomnes/go/src/github.com/xor-gate/goexif2/mknote/mknote.go:58 +0x2b4
github.com/xor-gate/goexif2/exif.Decode(0x12e6920, 0xc4204a4060, 0x2, 0x42, 0x0)
	/Users/vomnes/go/src/github.com/xor-gate/goexif2/exif/exif.go:331 +0x366

Code to fix it:

mknote/mknote.go:58
- } else if bytes.Compare(m.Val[:6], []byte("Nikon\000")) != 0 {
+ } else if len(m.Val) < 6 || bytes.Compare(m.Val[:6], []byte("Nikon\000")) != 0 {

Problem using exif.MarshalJSON() on sample images

Hello,

The MarshalJSON() function when run on several sample images gives an:

%!(EXTRA *json.MarshalerError=json: error calling MarshalJSON for type *tiff.Tag: invalid character '!' after top-level value)

This is in response I believe to the MarkerNote: "FUJIFILM0130" !"#,012NORMAL d"

This specifically happens with the exif/samples/2009-08-05-08-11-31-sep-2009-08-05-08-11-31a.jpg as well as some others.

Any ideas on how to correct this?

Thank you!

Decode failure: failed to read IFD tag count: EOF

Hi, I'm currently piping my entire photo library through goexif2 and I'm running into a decode failure with the following file: https://cloud.savanne.be/apps/gallery/s/bve5feag756seDj

exif: decode failed (tiff: failed to read IFD tag count: EOF)

Exiftool does manage to decode it correctly, so it must be some kind of known bug or unhandled case.

Will look into this further later on, but pointers on how to debug this further are definitely welcome.

Panic: runtime error: makeslice: len out of range in tiff.(*Tag).convertVals

I ran go-fuzz on the project and found two crashes in the same line.

Input is (in hexdump):

00000000  49 49 2a 00 08 00 00 00 30 30 30 30 05 00 00 00  |II*.....0000....|
00000010  00 a0 30 30 30 30                                |.ย 0000|

Dump:

panic: runtime error: makeslice: len out of range

goroutine 1 [running]:
github.com/xor-gate/goexif2/tiff.(*Tag).convertVals(0xc04205a280, 0xc042080480, 0xc04200e090)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/tiff/tag.go:258 +0x88c
github.com/xor-gate/goexif2/tiff.DecodeTag(0x30a0000, 0xc042080480, 0x5605c0, 0x613170, 0x514c20, 0xc04200e06c, 0x0)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/tiff/tag.go:182 +0x623
github.com/xor-gate/goexif2/tiff.DecodeDir(0x30a0000, 0xc042080480, 0x5605c0, 0x613170, 0xc042080480, 0x0, 0x0, 0x0)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/tiff/tiff.go:150 +0x1c5
github.com/xor-gate/goexif2/tiff.Decode(0x560240, 0xc042080480, 0x4, 0x4, 0xc042089df0)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/tiff/tiff.go:99 +0x548
github.com/xor-gate/goexif2/exif.Decode(0x560240, 0xc042080480, 0x5ae92fcc, 0x29751e98, 0x1e9999)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/exif/exif.go:285 +0x330
github.com/xor-gate/goexif2/exif.Fuzz(0x3900000, 0x16, 0x200000, 0xc042047f48)
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/exif/Fuzz.go:8 +0xba
go-fuzz-dep.Main(0x550580)
	/go-fuzz-build214414686/goroot/src/go-fuzz-dep/main.go:49 +0xb4
main.main()
	/go-fuzz-build214414686/gopath/src/github.com/xor-gate/goexif2/exif/go.fuzz.main/main.go:10 +0x34
exit status 2

Panic happens at https://github.com/xor-gate/goexif2/blob/develop/tiff/tag.go#L258:

case DTRational:
	t.ratVals = make([][]int64, int(t.Count)) // Panic
	for i := range t.ratVals {
		var n, d uint32

Looking at value of t.Count before that line we see 2684354560.

t.Count is read further up at https://github.com/xor-gate/goexif2/blob/develop/tiff/tag.go#L133:

err = binary.Read(r, order, &t.Count)
if err != nil {
	return nil, newTiffError("tag component count read failed", err)
}

Solution: We can check the value of t.Count after reading it and discard abnormally large values. I am not familiar enough to the file format to know how large it can be. This can be merged with the check right after L133.

if t.Count == 1<<32-1 || t.Count > (1<<20-1) {
	return t, newTiffError("invalid Count offset in tag", nil)
}

would be cool to use releases and semantic versioning

This is so that when using a dependency manager, we can lock to a version and get predictable builds

Otherwise, we're sticking to a commit sha or always pulling master.

For example, using glide, we can set it to only pull certain patch/minor versions based on our comfort.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.