Skip to content

Commit

Permalink
Check for empty buffer (#7)
Browse files Browse the repository at this point in the history
Avoids panic on empty tags
  • Loading branch information
scudette authored Jan 11, 2020
1 parent 0c80dd2 commit 4b74844
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion parser/pages.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ func (self *Value) Reader() io.ReaderAt {

func NewValue(ctx *ESEContext, tag *Tag, PageID int64, buffer []byte) *Value {
result := &Value{Tag: tag, PageID: PageID, Buffer: buffer}
if ctx.Version == 0x620 && ctx.Revision >= 17 && ctx.PageSize > 8192 {
if ctx.Version == 0x620 && ctx.Revision >= 17 &&
ctx.PageSize > 8192 && len(buffer) > 0 {
result.Flags = uint64(buffer[1] >> 5)
buffer[1] &= 0x1f
} else {
Expand Down

0 comments on commit 4b74844

Please sign in to comment.