Dinesh Belwalkar | e63f7f9 | 2019-11-22 23:11:16 +0000 | [diff] [blame] | 1 | package lz4 |
| 2 | |
| 3 | import ( |
| 4 | "errors" |
| 5 | "fmt" |
| 6 | "os" |
| 7 | rdebug "runtime/debug" |
| 8 | ) |
| 9 | |
| 10 | var ( |
| 11 | // ErrInvalidSourceShortBuffer is returned by UncompressBlock or CompressBLock when a compressed |
| 12 | // block is corrupted or the destination buffer is not large enough for the uncompressed data. |
| 13 | ErrInvalidSourceShortBuffer = errors.New("lz4: invalid source or destination buffer too short") |
| 14 | // ErrInvalid is returned when reading an invalid LZ4 archive. |
| 15 | ErrInvalid = errors.New("lz4: bad magic number") |
| 16 | // ErrBlockDependency is returned when attempting to decompress an archive created with block dependency. |
| 17 | ErrBlockDependency = errors.New("lz4: block dependency not supported") |
| 18 | ) |
| 19 | |
| 20 | func recoverBlock(e *error) { |
| 21 | if r := recover(); r != nil && *e == nil { |
| 22 | if debugFlag { |
| 23 | fmt.Fprintln(os.Stderr, r) |
| 24 | rdebug.PrintStack() |
| 25 | } |
| 26 | *e = ErrInvalidSourceShortBuffer |
| 27 | } |
| 28 | } |