Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompression not working lookbehind underrun #12

Open
sudeepigntion opened this issue Sep 18, 2020 · 3 comments
Open

Decompression not working lookbehind underrun #12

sudeepigntion opened this issue Sep 18, 2020 · 3 comments

Comments

@sudeepigntion
Copy link

It does not decompress packets, getting lookbehind underrun but I am using java anarres.lzo and I decompress the data

@sudeepigntion
Copy link
Author

Sample of the input 1a02595a2a2a313233004000054c95fdd700001c284028021dec213c00e04c0136f13220a0000701d600020000d1a90001601c600315722080144010034b4c9385eb003a00014b000a0c1740ec4002041a000e0834a02e0bb8000e06cca02e012c406dc928005e028aa02e0096000a11d5c02c411e11daa02e1cb6000e3f5ca02e02ee5d6128008e474fc02f0040bda0200140c66980601d80e2cc290002d1b228035600005c010240d1002002000041d70119f42702370119efc32577000efea6a02e1d4c000efd48e2342c00ee5cf72800ee5cfc008d002008000340cf33833740bfa42701402c02cc110000

@rminnich
Copy link

rminnich commented Nov 4, 2020

I can confirm the problem.

package main

import (
	"bytes"
	"encoding/hex"
	"log"
	"os"
	"os/exec"

	lzo "github.com/rasky/go-lzo"
)

var hosts = `127.0.0.1	localhost
127.0.1.1	rminnich-MacBookPro

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

192.168.0.1 centre
192.168.0.2 up
192.168.0.3 api2 u00:07:32:4b:f9:f3
192.168.0.4 api3 u00:07:32:4c:04:e6
192.168.0.5 api4 u00:07:32:4c:25:36
192.168.0.6 rome r uc8:b3:73:1f:44:55
192.168.0.7 a apu2 u00:0d:b9:49:0f:04
192.168.0.9 a300 ua8:a1:59:23:6b:75
192.168.0.239 router

# dresden
192.168.0.10 dellbmc u98:90:96:ff:fa:81
192.168.0.11 dell u4c:d9:8f:7f:58:93
192.168.0.12 upxtreme upx u u00:07:32:73:92:bb
192.168.0.13 upxtreme upx u u00:07:32:73:92:bc

192.168.86.70 zero
192.168.86.86 x230 corebootthinkpad tp

192.168.0.100 dlpower dl
`

func main() {
	c := exec.Command("lzop", "-1", "-c")
	c.Stdin = bytes.NewReader([]byte(hosts))
	o, err := c.CombinedOutput()
	if err != nil {
		log.Fatal(err)
	}
	w := hex.Dumper(os.Stdout)
	log.Println("original")
	if _, err := w.Write([]byte(hosts)); err != nil {
		log.Fatal(err)
	}
	w = hex.Dumper(os.Stdout)
	log.Println("\nFrom lzop:")
	if _, err := w.Write(o[:]); err != nil {
		log.Fatal(err)
	}
	w = hex.Dumper(os.Stdout)
	kb, err := lzo.Decompress1X(bytes.NewReader(o), 0, 0)
	if err != nil {
		log.Fatal(err)
	}

	log.Println("\nFrom package")
	if _, err := w.Write(kb[:0x400]); err != nil {
		log.Fatal(err)
	}

}

gets the underrun

Question is, did decompress work at some point, I'll try a bisect.

@rminnich
Copy link

rminnich commented Nov 4, 2020

so far I can not find a commit for which decompress works ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants