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

NumberFormatException while determining inode value (CpioHeader) #127

Open
dizzzz opened this issue Jan 4, 2018 · 0 comments
Open

NumberFormatException while determining inode value (CpioHeader) #127

dizzzz opened this issue Jan 4, 2018 · 0 comments

Comments

@dizzzz
Copy link
Contributor

dizzzz commented Jan 4, 2018

When running

java -cp redline-1.2.6-jar-with-dependencies.jar org.redline_rpm.Scanner myrpm-0.x86_64.rpm

I get the following message:

Payload compression: payloadcompressor[tag=1125,type=6,count=1,size=5,offset=1465]
        gzip
Exception in thread "main" java.lang.NumberFormatException: For input string: "f0199a88"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at org.redline_rpm.payload.CpioHeader.readEight(CpioHeader.java:160)
        at org.redline_rpm.payload.CpioHeader.read(CpioHeader.java:198)
        at org.redline_rpm.Scanner.main(Scanner.java:68)

Most of the other RPMs are correctly preccessed. Any idea how to get around this? Aby ideas/help is appreciated.

For sure "f0199a88" cannot be converted into an integer.

Here is the exception located:

public int read( final ReadableByteChannel channel, int total) throws IOException {
	total += skip( channel, total);
	ByteBuffer descriptor = Util.fill( channel, CPIO_HEADER);
	CharBuffer buffer = charset.decode( descriptor);

        // 6 bytes are read OK
	final CharSequence magic = readSix( buffer);
	if ( !MAGIC.equals(magic.toString())) throw new IllegalStateException( "Invalid magic number '" + magic + "' of length '" + magic.length() + "'.");

         // attempt to read 8 bytes : NOK - exception
	inode = readEight( buffer);
		
	final int mode = readEight( buffer);
	permissions = mode & 07777;
	type = mode >>> 12;

the full header (from debugger):

070701f0199a88000041ed00000000000000000000000254ad23b800000000000000000000001100000000000000000000002c00000000

the value "f0199a88" is too large to fit in an integer:

    @Test(expected=NumberFormatException.class)
    public void parseInt() throws Exception {
        final int result = Integer.parseInt("f0199a88", 16);
    }

    @Test
    public void parseLong() throws Exception {
        final long result = Long.parseLong("f0199a88", 16);
        assertEquals(4028209800L ,result );
    }

All elements (I assume)

070701      magic
f0199a88    inode
000041ed    mode
00000000    uuid
00000000    gid
00000002    link
54ad23b8    mtime
00000000    filesize
00000000    devMajor
00000011    devMinor
00000000    rdevMajor
00000000    rdevMinor
0000002c    namesize
00000000    checksum
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

1 participant