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

Error on Login: java.lang.ArithmeticException / by zero #345

Open
hrxcodes opened this issue Mar 22, 2024 · 0 comments
Open

Error on Login: java.lang.ArithmeticException / by zero #345

hrxcodes opened this issue Mar 22, 2024 · 0 comments

Comments

@hrxcodes
Copy link
Contributor

Describe the bug
Something caused

env.put("averagespeed", Bytes.formatBytes((user.getDownloadedBytes() + user.getUploadedBytes())
/ (((user.getDownloadedTime() + user.getUploadedTime()) / 1000) + 1)));
to have invalid values which leds to java.lang.ArithmeticException / by zero

DrFTPD

  • DrFTPD version 4.0.12

Additional context

commands.log

ERROR 2024-03-22T14:33:32,612 [FtpConn thread 578027 from <iphidden> - pool-394638-thread-1] org.drftpd.master.commands.StandardCommandManager [] - Command user failed: 'testuser'
java.lang.ArithmeticException: / by zero
        at org.drftpd.master.network.Session.getReplacerEnvironment(Session.java:71) ~[drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at org.drftpd.master.network.Session.jprintf(Session.java:109) ~[drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at org.drftpd.master.commands.login.LoginHandler.doUSER(LoginHandler.java:281) ~[drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at jdk.internal.reflect.GeneratedMethodAccessor401.invoke(Unknown Source) ~[?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
        at org.drftpd.master.commands.StandardCommandManager.execute(StandardCommandManager.java:227) [drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at org.drftpd.master.network.BaseFtpConnection.executeFtpCommand(BaseFtpConnection.java:639) [drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at org.drftpd.master.network.BaseFtpConnection$CommandThread.run(BaseFtpConnection.java:693) [drftpd-master-4.0.12-SNAPSHOT.jar:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.base/java.lang.Thread.run(Thread.java:840) [?:?]

Userfile:

{
  "@type":"org.drftpd.master.usermanager.encryptedjavabeans.EncryptedBeanUser",
  "_encryption":7,
  "_password":"**REDACTED**",
  "_data":{
    "@keys":[
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"minratio",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"created",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"weekReqs",
        "_owner":"org.drftpd.request.master.metadata.RequestUserData"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"logins",
        "_owner":"org.drftpd.statistics.master.metadata.StatsUserData"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"ban_time",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"tagline",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"maxsimup",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"maxratio",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"wkly_allotment",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"leechslots",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"lastseen",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"ratio",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"groupslots",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"maxsimdn",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"maxloginsip",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"ircident",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"maxlogins",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      },
      {
        "@type":"org.drftpd.common.dynamicdata.Key",
        "_key":"comment",
        "_owner":"org.drftpd.master.commands.usermanagement.UserManagement"
      }
    ],
    "@items":[
      {
        "@type":"float",
        "value":1.0
      },
      {
        "@type":"date",
        "value":1657640555975
      },
      {
        "@type":"int",
        "value":0
      },
      {
        "@type":"int",
        "value":3147
      },
      {
        "@type":"date",
        "value":1657640555975
      },
      "tagline",
      {
        "@type":"int",
        "value":2
      },
      {
        "@type":"float",
        "value":3.0
      },
      0,
      {
        "@type":"int",
        "value":0
      },
      {
        "@type":"date",
        "value":1711114321403
      },
      {
        "@type":"float",
        "value":3.0
      },
      {
        "@type":"int",
        "value":0
      },
      {
        "@type":"int",
        "value":2
      },
      {
        "@type":"int",
        "value":5
      },
      "",
      {
        "@type":"int",
        "value":5
      },
      "some comment"
    ]
  },
  "_lastReset":0,
  "_credits":6540305168416,
  "_group":"GRP",
  "_groups":[],
  "_hostMasks":[
    {
      "@type":"org.drftpd.common.util.HostMask",
      "_hostMask":"x.x.x.*",
      "_identMask":"*"
    },
    {
      "@type":"org.drftpd.common.util.HostMask",
      "_hostMask":"x.x.x.*",
      "_identMask":"*"
    }
  ],
  "_idleTime":300,
  "_username":"something",
  "_uploadedBytes":[
    -125538012,-125538012,-125538012,-125538012
  ],
  "_downloadedBytes":[
    8847,0,0,0
  ],
  "_downloadedFiles":[
    1,0,0,0
  ],
  "_downloadedMilliSeconds":[
    32,0,0,0
  ],
  "_uploadedFiles":[
    -1,-1,-1,-1
  ],
  "_uploadedMilliSeconds":[
    -1224,-1224,-1224,-1224
  ]
}
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

1 participant