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

mediainfo - cast to int fails and crashes slave #198

Open
hrxcodes opened this issue Mar 8, 2021 · 4 comments
Open

mediainfo - cast to int fails and crashes slave #198

hrxcodes opened this issue Mar 8, 2021 · 4 comments

Comments

@hrxcodes
Copy link
Contributor

hrxcodes commented Mar 8, 2021

Describe the bug

ERROR 2021-03-08T00:04:59,988 [AsyncCommandHandler - class org.drftpd.common.network.AsyncCommandArgument] org.drftpd.slave.protocol.SlaveProtocolCentral [] - Unable to invoke: public org.drftpd.common.network.AsyncResponse org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(org.drftpd.common.network.AsyncCommandArgument)
java.lang.reflect.InvocationTargetException: null
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at org.drftpd.slave.protocol.SlaveProtocolCentral.handleCommand(SlaveProtocolCentral.java:184) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.slave.Slave.handleCommand(Slave.java:504) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.slave.Slave$1AsyncCommandHandler.run(Slave.java:545) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.lang.RuntimeException: A cast to int has gone wrong. Please contact the mp4parser discussion group (3735127950)
        at org.mp4parser.tools.CastUtils.l2i(CastUtils.java:30) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.support.AbstractBox.parse(AbstractBox.java:97) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:116) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.IsoFile.<init>(IsoFile.java:57) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.IsoFile.<init>(IsoFile.java:40) ~[isoparser-1.9.41.jar:?]
        at org.drftpd.mediainfo.common.MediaInfo.getMediaInfoFromFile(MediaInfo.java:132) ~[drftpd-mediainfo-common-4.0-SNAPSHOT.jar:?]
        at org.drftpd.mediainfo.slave.MediaInfoHandler.getMediaInfo(MediaInfoHandler.java:56) ~[drftpd-mediainfo-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(MediaInfoHandler.java:49) ~[drftpd-mediainfo-slave-4.0-SNAPSHOT.jar:?]
        ... 8 more
ERROR 2021-03-08T00:05:00,005 [AsyncCommandHandler - class org.drftpd.common.network.AsyncCommandArgument] org.drftpd.slave.protocol.SlaveProtocolCentral [] - Invokation failed due to: public org.drftpd.common.network.AsyncResponse org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(org.drftpd.common.network.AsyncCommandArgument)
java.lang.RuntimeException: A cast to int has gone wrong. Please contact the mp4parser discussion group (3735127950)
        at org.mp4parser.tools.CastUtils.l2i(CastUtils.java:30) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.support.AbstractBox.parse(AbstractBox.java:97) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:116) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.IsoFile.<init>(IsoFile.java:57) ~[isoparser-1.9.41.jar:?]
        at org.mp4parser.IsoFile.<init>(IsoFile.java:40) ~[isoparser-1.9.41.jar:?]
        at org.drftpd.mediainfo.common.MediaInfo.getMediaInfoFromFile(MediaInfo.java:132) ~[drftpd-mediainfo-common-4.0-SNAPSHOT.jar:?]
        at org.drftpd.mediainfo.slave.MediaInfoHandler.getMediaInfo(MediaInfoHandler.java:56) ~[drftpd-mediainfo-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(MediaInfoHandler.java:49) ~[drftpd-mediainfo-slave-4.0-SNAPSHOT.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
        at org.drftpd.slave.protocol.SlaveProtocolCentral.handleCommand(SlaveProtocolCentral.java:184) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.slave.Slave.handleCommand(Slave.java:504) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at org.drftpd.slave.Slave$1AsyncCommandHandler.run(Slave.java:545) [drftpd-slave-4.0-SNAPSHOT.jar:?]
        at java.lang.Thread.run(Thread.java:832) [?:?]
@ghost ghost added this to the 4.0.1-dev milestone Mar 14, 2021
@mvangoor
Copy link
Contributor

Did a little investigation and mp4parser assumes the size of a mp4 file does not exceed integer.maxvalue...
see https://github.com/sannies/mp4parser/blob/master/isoparser/src/main/java/org/mp4parser/tools/CastUtils.java#L29
max_value should be 2147483647 and is obviously larger than 3735127950 ...

This will require some more looking/attention

@hrxcodes
Copy link
Contributor Author

Not reproducible by zc0nf, let's keep an eye open

@hrxcodes
Copy link
Contributor Author

hrxcodes commented Jan 4, 2022

Another user reported the same issue on IRC today;

drftpd 4.0.7

ERROR 2022-01-04T15:40:15,258 [AsyncCommandHandler - class org.drftpd.common.network.AsyncCommandArgument] org.drftpd.slave.protocol.SlaveProtocolCentral [] - Invokation failed due to: public org.drftpd.common.network.AsyncResponse org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(org.drftpd.common.network.AsyncCommandArgument)
java.lang.RuntimeException: A cast to int has gone wrong. Please contact the mp4parser discussion group (4045027944)
    at org.mp4parser.tools.CastUtils.l2i(CastUtils.java:30) ~[isoparser-1.9.41.jar:?]
    at org.mp4parser.support.AbstractBox.parse(AbstractBox.java:97) ~[isoparser-1.9.41.jar:?]
    at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:116) ~[isoparser-1.9.41.jar:?]
    at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107) ~[isoparser-1.9.41.jar:?]
    at org.mp4parser.IsoFile.<init>(IsoFile.java:57) ~[isoparser-1.9.41.jar:?]
    at org.mp4parser.IsoFile.<init>(IsoFile.java:40) ~[isoparser-1.9.41.jar:?]
    at org.drftpd.mediainfo.common.MediaInfo.getMediaInfoFromFile(MediaInfo.java:148) ~[drftpd-mediainfo-common-4.0.7-SNAPSHOT.jar:?]
    at org.drftpd.mediainfo.slave.MediaInfoHandler.getMediaInfo(MediaInfoHandler.java:65) ~[drftpd-mediainfo-slave-4.0.7-SNAPSHOT.jar:?]
    at org.drftpd.mediainfo.slave.MediaInfoHandler.handleMediaInfo(MediaInfoHandler.java:58) ~[drftpd-mediainfo-slave-4.0.7-SNAPSHOT.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?]
    at org.drftpd.slave.protocol.SlaveProtocolCentral.handleCommand(SlaveProtocolCentral.java:183) [drftpd-slave-4.0.7-SNAPSHOT.jar:?]
    at org.drftpd.slave.Slave.handleCommand(Slave.java:455) [drftpd-slave-4.0.7-SNAPSHOT.jar:?]
    at org.drftpd.slave.Slave$1AsyncCommandHandler.run(Slave.java:496) [drftpd-slave-4.0.7-SNAPSHOT.jar:?]
    at java.lang.Thread.run(Thread.java:832) [?:?]

@hrxcodes hrxcodes reopened this Oct 28, 2022
@mvangoor
Copy link
Contributor

mvangoor commented Nov 6, 2022

So checking the code (again) we see it checks for Integer.MAX_VALUE which is 2147483647.

In both examples the size is larger than this value...

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

No branches or pull requests

2 participants