Menu

#66 Crash: IllegalArgumentException: Policy 0 too short for flags: 4

Misc
open
None
1
2023-06-27
2023-06-09
Anonymous
No

I'm getting this crash on Android 13 (latest regular release version, unrooted, Pixel 6a) when trying to open a specific safe file. (The crash only happens when the right password is entered, right after that.) The file opens just fine in the Windows application on my computer. Another safe file (I have multiple in use) opens just fine. Both files are in the same place (Google Drive, but I've also explicitly downloaded the safe file from there and then opened it locally - same crash).

Here's the full stack trace that the app lets me copy:

java.lang.IllegalArgumentException: Policy 0 too short for flags: 4
    at com.jefftharris.passwdsafe.file.PasswdPolicy.getPolicyStrField(PasswdPolicy.java:695)
    at com.jefftharris.passwdsafe.file.PasswdPolicy.getPolicyStrInt(PasswdPolicy.java:681)
    at com.jefftharris.passwdsafe.file.PasswdPolicy.parsePolicyFlagsAndLengths(PasswdPolicy.java:636)
    at com.jefftharris.passwdsafe.file.PasswdPolicy.parseHdrPolicy(PasswdPolicy.java:481)
    at com.jefftharris.passwdsafe.file.PasswdPolicy.parseHdrPolicies(PasswdPolicy.java:522)
    at com.jefftharris.passwdsafe.file.PasswdFileData.indexPasswdPolicies(PasswdFileData.java:1309)
    at com.jefftharris.passwdsafe.file.PasswdFileData.indexRecords(PasswdFileData.java:1302)
    at com.jefftharris.passwdsafe.file.PasswdFileData.finishOpenFile(PasswdFileData.java:1256)
    at com.jefftharris.passwdsafe.file.PasswdFileData.load(PasswdFileData.java:115)
    at com.jefftharris.passwdsafe.PasswdSafeOpenFileFragment$OpenTask.doInBackground(PasswdSafeOpenFileFragment.java:834)
    at com.jefftharris.passwdsafe.PasswdSafeOpenFileFragment$OpenTask.doInBackground(PasswdSafeOpenFileFragment.java:806)
    at com.jefftharris.passwdsafe.lib.ManagedTask$Task.doInBackground(ManagedTask.java:130)
    at com.jefftharris.passwdsafe.lib.ManagedTask$Task.doInBackground(ManagedTask.java:98)
    at android.os.AsyncTask$3.call(AsyncTask.java:394)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)

I was able to open this file in the past just fine, although I haven't done so for a while. I haven't really changed anything fundamental on my phone, either. I'm pretty sure I already had Android 13 when I last opened the safe file (successfully), too.

The only thing different between the safe files I can think about is that the password for the safe file that produces the crash is pretty long: Over 25 characters. The other passwords I have are shorter. I don't know if this could be related.

I hope this can be resolved, since I now cannot access my password in this safe file on my phone anymore.
If you need more information to debug this, I can (probably) provide them!

Discussion

  • Anonymous

    Anonymous - 2023-06-09

    Oh, and I'm using the latest version that is available on the Google Play Store.

     
  • Jeff Harris

    Jeff Harris - 2023-06-13

    Have you been editing the file only in the app or using another compatible program e.g. Password Safe on the PC or Password Gorilla?

    Does the record policy or another policy have special characters set that are not the defaults?

    If you could create a test file which has the problem, it would help a lot. I don't really want your own file which has your own passwords in it.

     
  • Anonymous

    Anonymous - 2023-06-24

    As far as I remember, I've only edited the file on PC with the Windows version. On the phone, I'm only opening it to use passwords, I don't make edits there.

    I just tried to make (again, with the PC version) a new safe file with the exact same password and a single dummy entry, and that can be opened fine. So that's not the issue, it seems.

    Could it have something to do with the password policy?
    I edited the default policy to make much longer passwords, with a larger minimum amount of special characters and the like too. However, when I edit the default policy to be the same for both the crashing safe and my new test safe, it still works on the test safe...
    I noticed that the app doesn't show the default policy of the safe correctly: It always claims that it has the default values (12 characters long, at least 1 capital letter, special character, etc). It seems it shows it correctly for user-created policies (that are not the default policy).

     
  • Anonymous

    Anonymous - 2023-06-24

    After looking at the first of your links, I made a small edit to the crashing safe with the Windows Password Safe (I just added a new dummy entry).
    Now it seems I can open the safe with the Android version again. No crash.

    So, uh, yeah, I have no idea what had previously happened to the file that it made the Android version crash, and why this gets fixed after making another edit in the PC version.

     
  • Jeff Harris

    Jeff Harris - 2023-06-27

    There was a bug in the app a little while ago where saving wouldn't work right if the file was shortened. That should have been fixed, though.

    It's good that the file is working again. If it does happen and can be seen in a test file, I'd be most interested in examining it.

     

Anonymous
Anonymous

Add attachments
Cancel