Compare commits
2646 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| feef2e38cf | |||
| 80d30aab32 | |||
| e910a9dc3e | |||
| 504224696c | |||
| e2acd666df | |||
| e5c0d998b7 | |||
| 63f6fef964 | |||
| 983eb6d676 | |||
| 98fedef1a1 | |||
| 75a769759d | |||
| 2354b01bad | |||
| c331b9f1e2 | |||
| afeaeeddec | |||
| ab7ef9f511 | |||
| d3ad6d25d8 | |||
| 2e29f9fa5f | |||
| 5d9f71bb13 | |||
| 82ed25bb44 | |||
| f57393c0e8 | |||
| b54cced19c | |||
| 60a0544314 | |||
| 283c1cf931 | |||
| fff53efc05 | |||
| 07d368adca | |||
| 13276d93fa | |||
| 79b1b1a586 | |||
| 2f083f3e56 | |||
| 73b0b4db9d | |||
| ca0e614b56 | |||
| 72613d06a5 | |||
| 48ad5513ff | |||
| 201d9f1346 | |||
| 1e8f1f49d0 | |||
| 65707900bc | |||
| 39c5be43aa | |||
| c4437cb293 | |||
| e2b86a49db | |||
| 8fe83be87f | |||
| 17167d4905 | |||
| 05ff7e35a1 | |||
| f67cec4752 | |||
| fd4882abcf | |||
| 0f42579e68 | |||
| 7398d8f68f | |||
| ec33109b22 | |||
| 2cfa4c1eb7 | |||
| a13b4d10d9 | |||
| 36e94e58d0 | |||
| d0a52bd483 | |||
| 38a1d3179b | |||
| 0d639d6386 | |||
| 4256057c27 | |||
| b720b47c12 | |||
| 55e4a4f086 | |||
| b4cb9f8b2f | |||
| 63298ebd6d | |||
| 73c816e468 | |||
| 0492e650ef | |||
| b8b94ee89e | |||
| 81176716d5 | |||
| 26e7ae00e9 | |||
| c75d7a685d | |||
| 4318cc22ee | |||
| 575cb720c6 | |||
| 5db34fbf92 | |||
| 7cfef2f6bf | |||
| 4603f1df4b | |||
| c69fcfff9d | |||
| 70f14101ed | |||
| a9803459ed | |||
| 43034e8e92 | |||
| ef547034f6 | |||
| e87fc60391 | |||
| 45e6e73d85 | |||
| be30c26dbb | |||
| 79e9b0762c | |||
| a9a806c418 | |||
| c7d8b6fed1 | |||
| a723efd225 | |||
| cf429dfce4 | |||
| 3fcd64a0c0 | |||
| 83cb38022b | |||
| 93c04d1f66 | |||
| 3c47898cf4 | |||
| 61e1366122 | |||
| a20636fd63 | |||
| aa8cdca0a9 | |||
| 6931a3aa70 | |||
| d001a63bce | |||
| 0d3377f48b | |||
| aeb04d97c8 | |||
| eb68ab91cd | |||
| ee242ba987 | |||
| 44a53736ff | |||
| 1b21fef081 | |||
| 5f9c50cd3e | |||
| 793d8c1d2e | |||
| 81f868a0c6 | |||
| dadbbbdc64 | |||
| bfd2153f2b | |||
| 077793fa5e | |||
| acad3c3000 | |||
| 3b4627e17e | |||
| 05976ee1a7 | |||
| c1311c78a3 | |||
| 717150b7f3 | |||
| a68c62d938 | |||
| c11f8a569a | |||
| 03436d2415 | |||
| 4ae75375e0 | |||
| 2721ef0636 | |||
| 7a232cb330 | |||
| 52f19ae330 | |||
| 275477f914 | |||
| 2ed6755d5d | |||
| 78c555b4a6 | |||
| a127125707 | |||
| f853f91c5b | |||
| e7ca5c54ff | |||
| 663d6b466b | |||
| 0e2a9de2b2 | |||
| 34df0d6ef1 | |||
| 540164849b | |||
| 252143d0bb | |||
| 480ab51650 | |||
| 972c76eb42 | |||
| e5aeea9ed2 | |||
| f204670008 | |||
| 651155c64d | |||
| 660aee6d22 | |||
| a646231630 | |||
| 1050de5171 | |||
| b7a5b9437a | |||
| 620955a724 | |||
| 2e64a277f8 | |||
| ea567a8b14 | |||
| be23f93ee6 | |||
| fcdf0e92c1 | |||
| 2d6987252e | |||
| 4a9c46253e | |||
| 5bcf9dd8af | |||
| 284adb203f | |||
| adafa841f7 | |||
| fdc5d25d03 | |||
| 294a7077de | |||
| 990d0ec543 | |||
| bb90c4dff4 | |||
| 00e3d992e8 | |||
| 937bfa4e49 | |||
| 1d9c211eed | |||
| 76ddf6b8da | |||
| 7f1f29b0d8 | |||
| 222471744f | |||
| cc100be26e | |||
| 966b571b7c | |||
| f3e710394a | |||
| bfd1f1fbfa | |||
| a09146b5e0 | |||
| bbf2b08f48 | |||
| e2dbc661f1 | |||
| 7626e09f66 | |||
| 248a6980cf | |||
| f956bfc797 | |||
| 6da79783ea | |||
| 22329e0ab2 | |||
| a94b0329c9 | |||
| be8601f8cc | |||
| bd441e83ae | |||
| 02bd9cc403 | |||
| c9f6a3583c | |||
| 076aaf829a | |||
| 85f0c5a445 | |||
| d5263a56ce | |||
| ef5b55b4d1 | |||
| d65e65b2b1 | |||
| 6aa641e5aa | |||
| 504839951a | |||
| d55746f62d | |||
| 144010295e | |||
| 181c752488 | |||
| bd4aca5c12 | |||
| ad6d73c875 | |||
| c5cc83d424 | |||
| fe949bdf67 | |||
| 766fe466d6 | |||
| 333a288248 | |||
| 613df414ed | |||
| be050693f2 | |||
| bf957f435e | |||
| 3a6f688265 | |||
| 1084a7896c | |||
| 9ea2b31541 | |||
| 09da986742 | |||
| cb70a5fef5 | |||
| 4fa6a6aeef | |||
| ab31e8dde9 | |||
| 53d7b5449f | |||
| d33a34f016 | |||
| f6ff5a2805 | |||
| 1518e5bc98 | |||
| 78f48d65d5 | |||
| b81ec224b7 | |||
| 4be6cfebcd | |||
| 98973dd8b9 | |||
| 1218b6ff2a | |||
| ba5c77c9e5 | |||
| cbaedffce2 | |||
| cb60603950 | |||
| 0a69e7803b | |||
| baa9090198 | |||
| e78a08b8fc | |||
| 7e5e6012df | |||
| 0a1d24d1d9 | |||
| 35555bfb8a | |||
| c9cb42df40 | |||
| 2be03028f4 | |||
| 214dd0a522 | |||
| 182e0796df | |||
| fb844a8ed1 | |||
| 6be3e747ca | |||
| 23f63e4196 | |||
| fd6837b267 | |||
| 1c29f921e0 | |||
| 1ab6e01de2 | |||
| 801618740c | |||
| 2469563b26 | |||
| 00139caf43 | |||
| 21d102c84f | |||
| f17d9967c2 | |||
| 0569ef37ba | |||
| 984334c9a1 | |||
| 34a25e61c7 | |||
| ed3f45953e | |||
| 80de11bc5b | |||
| c9fe84c9aa | |||
| 5f98bb0ab0 | |||
| d86d5314ba | |||
| 700c8730cf | |||
| b4429e1a42 | |||
| a8fa3ca5cf | |||
| 9aef7b0d6f | |||
| 2575eef3c0 | |||
| 8236276a90 | |||
| fdc68812c5 | |||
| 9db6d18d11 | |||
| f962afe146 | |||
| adcd569852 | |||
| d045b7f223 | |||
| 57cb6a7530 | |||
| baa1ed9be3 | |||
| 16af6e1a29 | |||
| 0af8998be6 | |||
| c32f517fa5 | |||
| 9131d5216f | |||
| fb14a7991d | |||
| ff53862dab | |||
| 49245a20c5 | |||
| 13bc031163 | |||
| 0c18c1c35c | |||
| 63dc19ce25 | |||
| 6871c2fc0a | |||
| 4ae3a8b2b0 | |||
| f2e562b5de | |||
| f7e2266c3f | |||
| 361a3056cb | |||
| ca0437556d | |||
| 51899957a9 | |||
| 7b0b760d78 | |||
| 4f5866b5a7 | |||
| a6b5033cf1 | |||
| a6296ecd67 | |||
| bb1df15958 | |||
| 249431f45f | |||
| cbe129795e | |||
| 2a135e245b | |||
| 05a0b3557a | |||
| c7cfe8b608 | |||
| 8d3e1d28a7 | |||
| 7841e15583 | |||
| dd164fbc86 | |||
| 23fe02e84a | |||
| 94e72238f2 | |||
| 8f7ac520eb | |||
| bd193201b2 | |||
| 8ced672d24 | |||
| f218812858 | |||
| 8a7b980fc0 | |||
| 385c9877f8 | |||
| 10df93536e | |||
| 6cad27896f | |||
| 052392d97b | |||
| ce6b5a0688 | |||
| 1879185e42 | |||
| a928a08f9d | |||
| 1805cb6857 | |||
| 6ce625b535 | |||
| 4702f12818 | |||
| 4f3054f07d | |||
| 0d7bd52e21 | |||
| c3466f579c | |||
| 7c105d7af5 | |||
| 924b229afb | |||
| 890d66ecf0 | |||
| 143049922b | |||
| e6ccef2cf1 | |||
| be61e9f584 | |||
| 89d0fda9fa | |||
| 6a85bab5da | |||
| c1a55b063e | |||
| 77c914bce5 | |||
| cc60f03b2e | |||
| cc9ccdbbd1 | |||
| 9dfc8f573c | |||
| 4e2fdb464a | |||
| 73b854874e | |||
| 0016512df1 | |||
| 527139978a | |||
| 47bc68fa6b | |||
| 972b670a64 | |||
| d7c416f243 | |||
| 3ace7a0468 | |||
| d305023f5e | |||
| 963392a5ae | |||
| 2f453acf5d | |||
| 4ae1576726 | |||
| 17bd0b3248 | |||
| a1ad1aee99 | |||
| a817ed0692 | |||
| 828a6cf07b | |||
| 962c35aa08 | |||
| b327645e64 | |||
| e1b42616a2 | |||
| f96638c42a | |||
| 6272152dfe | |||
| 030a200c08 | |||
| 994da63b4d | |||
| 2315bff280 | |||
| 98dddf93d8 | |||
| fd2939e18d | |||
| 80c27e0822 | |||
| b463f24eda | |||
| 2a849444db | |||
| 69e106c0c5 | |||
| 926481dace | |||
| a3b2cde58d | |||
| 30f37d2cc6 | |||
| c4d61dd9fe | |||
| 210870f840 | |||
| 4cb4bd38eb | |||
| 58c6d19f7c | |||
| f99ae94747 | |||
| 6868ca7953 | |||
| 87a5a4ef32 | |||
| c67a5d677c | |||
| 1ce6f0e6f4 | |||
| 740b4ff865 | |||
| 1059f62566 | |||
| df3193c1ee | |||
| 67860e3704 | |||
| 35fbb1ecb6 | |||
| c63a71ad42 | |||
| f33645f739 | |||
| d7ba31cab8 | |||
| 342b1b7d6c | |||
| 936013f60c | |||
| fdf2eddc73 | |||
| 4409753014 | |||
| 9172ae3d19 | |||
| e2f60adc95 | |||
| 1bb93d4fce | |||
| eb90eab632 | |||
| 0f4975fd7f | |||
| b5b1f06a11 | |||
| 86f8eb0930 | |||
| 91ad0e7572 | |||
| b034ee98fe | |||
| ded07f8781 | |||
| 849bdd87e1 | |||
| 643e48efd7 | |||
| 92f072cf70 | |||
| 95bf2e2e41 | |||
| 6a6c6d84eb | |||
| 08a689c81e | |||
| d1174385ef | |||
| cb5f590e10 | |||
| 5ed9c66ed9 | |||
| b8f52d14f4 | |||
| 5d295c24f0 | |||
| 8be9da8280 | |||
| 819c33fee2 | |||
| 75a2cc4ecb | |||
| e2833cf303 | |||
| 801de73dbe | |||
| 6a53c0b3d4 | |||
| 58b122d97d | |||
| 276b748aa6 | |||
| 23570097cf | |||
| 62a07df45e | |||
| 593a69ce25 | |||
| c33603e324 | |||
| 29fa358077 | |||
| 49766388bc | |||
| f23267bddd | |||
| 4484acf9d6 | |||
| 47ddace96a | |||
| 8aadbcd786 | |||
| 517bc9db0b | |||
| 16bfa7b846 | |||
| 570b2d0e88 | |||
| 2653a0749a | |||
| 3de0008543 | |||
| d4e2d7e8a8 | |||
| a9c08c6f52 | |||
| c2aa5c35f7 | |||
| 423f1a8758 | |||
| cc5f684e33 | |||
| b6646d319a | |||
| 3667fa4e44 | |||
| d1c80154f6 | |||
| 3c2bfc742e | |||
| d60fef753f | |||
| 70ed2d0d03 | |||
| 716d203a78 | |||
| 9719a7dd56 | |||
| c097233bf3 | |||
| 69a583281f | |||
| 8e90c9af2b | |||
| a784284b7f | |||
| 0509edf08d | |||
| 7ca20f424f | |||
| b74d51c2a8 | |||
| 58061cd121 | |||
| b8f6be5389 | |||
| 7c766b3313 | |||
| 91b81b587b | |||
| 780a4347b8 | |||
| 606ad08dd1 | |||
| 75c31dff1d | |||
| 473b90419f | |||
| f88b85e126 | |||
| b122f8e9d0 | |||
| cb8b1595a1 | |||
| 1bee919276 | |||
| 78b1da5c00 | |||
| bb8239ccda | |||
| 2a594ad0a7 | |||
| b05073550c | |||
| 37d6a34e58 | |||
| 4f0cba9bb6 | |||
| 4d1c754af9 | |||
| c1cfde21d7 | |||
| bb1f9cdecd | |||
| b259b0ca28 | |||
| 0051dfc84f | |||
| 9f294e6ce5 | |||
| 153ea8be03 | |||
| f3f7f97f8d | |||
| 9bb6854e64 | |||
| 4bba1e6cb7 | |||
| 597e8fe407 | |||
| 556c541ffb | |||
| 5963f18f7c | |||
| 0dac6b7be3 | |||
| 296ede780b | |||
| faaa19331a | |||
| 88cb5886f3 | |||
| 2fcc3f86c0 | |||
| 9362fde9eb | |||
| 56f4d781c1 | |||
| 7a3637ff5a | |||
| 2923c0968e | |||
| 98cfe99d65 | |||
| bdd97fe0b2 | |||
| 6b500bc83b | |||
| 92a12a2ec1 | |||
| 04d79040f9 | |||
| 3201ddc680 | |||
| 2f06de54c5 | |||
| 6489ec9bba | |||
| 1a5ba22fe7 | |||
| 8f9713ed53 | |||
| 90eb68b3b9 | |||
| 95fcbcb4f2 | |||
| b97688d119 | |||
| 5ea3627cab | |||
| d9288213ec | |||
| 614c86fb7d | |||
| 9f651ee40f | |||
| 774c8c3fd4 | |||
| b711d2f750 | |||
| 8a793d5942 | |||
| 99f52c60ed | |||
| 2c2e108301 | |||
| 563165e6ae | |||
| f1a31b4793 | |||
| 5e9b6bd69d | |||
| 9b990c4eae | |||
| 7a625a449a | |||
| c2b62359d5 | |||
| 6722e8972e | |||
| fefe7a3452 | |||
| 90a1322929 | |||
| d698eb69e2 | |||
| 0ef00e9b82 | |||
| 95cedb6640 | |||
| d736da4208 | |||
| be83788666 | |||
| 5a28a51abc | |||
| 8a84df752c | |||
| 85f53b210d | |||
| 5d13c6cd01 | |||
| 98a0d381e9 | |||
| e1d20fd0b5 | |||
| d1035ecd8f | |||
| 0e651facdd | |||
| 9fdddfc332 | |||
| 7d2913709c | |||
| 3623199e8d | |||
| e4b23f7a47 | |||
| f056ecdcd5 | |||
| 857a03a074 | |||
| a34deee4f5 | |||
| fc9c8ae482 | |||
| 08c63f06eb | |||
| bbff510ef1 | |||
| f747435952 | |||
| e6edad8f46 | |||
| 05e44b9644 | |||
| 16bb7ab841 | |||
| 9248f02557 | |||
| 9485a56af1 | |||
| 021c8db58a | |||
| 8ab180edf8 | |||
| ab35b685d4 | |||
| 86745721ee | |||
| c34fe09a79 | |||
| 1fa9ff2c05 | |||
| e8ef0cf63f | |||
| 8c84efb8fb | |||
| f3a7620ae8 | |||
| c7969ed5a5 | |||
| 900926c0ed | |||
| df94f4288a | |||
| 969efe687d | |||
| ee3f1292d0 | |||
| cacb239040 | |||
| 28d1789783 | |||
| 633eb98e34 | |||
| 4854c03096 | |||
| e853119c77 | |||
| 161a58bafb | |||
| f5fd94e815 | |||
| edde6210f1 | |||
| 507e19945e | |||
| 4a35bf32ea | |||
| e04bf9e4bc | |||
| c384d224c0 | |||
| 35427f998e | |||
| 1174da2bc3 | |||
| 11e8a47030 | |||
| 8c4e9bcf0d | |||
| 9dfd624901 | |||
| 79e65503a9 | |||
| 59f18b9d9f | |||
| fb3699fb89 | |||
| 9d2d59b5d2 | |||
| aefb2fa3c3 | |||
| e8aa80f904 | |||
| 990988f920 | |||
| 576d9a4e7e | |||
| 1d462ee424 | |||
| c9b09555c4 | |||
| 860b5bf967 | |||
| 5063480a38 | |||
| 3400ae9dbe | |||
| 3385264eb2 | |||
| 34646f1c6a | |||
| 50aa63a5a0 | |||
| 64557bee43 | |||
| 7c21c4513e | |||
| c6d6378005 | |||
| 4f6979967d | |||
| e633c51b50 | |||
| 143f0accef | |||
| b413f3da26 | |||
| 6eafa552bb | |||
| 7a0514d9b4 | |||
| 7e7565299e | |||
| ed34a089c6 | |||
| d14a2c5282 | |||
| f014406b65 | |||
| 58771ecca6 | |||
| 5d9dcb634b | |||
| 19c2c1edcf | |||
| 0430e7931e | |||
| bb8e607442 | |||
| e61ada944d | |||
| 46730315e3 | |||
| 4869142034 | |||
| 8e42e17bbf | |||
| 38c8b84a26 | |||
| c652626a37 | |||
| 06f6e47ebf | |||
| 403b180b1d | |||
| ee008acfbd | |||
| d149092ac0 | |||
| eafa136c69 | |||
| 402c885987 | |||
| 5e7e0508b9 | |||
| ff1d5fb794 | |||
| ad3f63b5c4 | |||
| a3e51e6dee | |||
| c1b9c79f54 | |||
| e0bc040b0a | |||
| 85eb4c7537 | |||
| 1f929d47d0 | |||
| 608662d73b | |||
| 7841d23e77 | |||
| b72dda4ada | |||
| c59c8a1ea2 | |||
| 1522293be0 | |||
| b37bc99330 | |||
| 7f905724b1 | |||
| 2bf5bb1625 | |||
| 08d3376740 | |||
| 7bace76176 | |||
| ef336dbcc6 | |||
| ca7217e717 | |||
| 3931cb7871 | |||
| 9e8de4abe5 | |||
| 26be845563 | |||
| 2f11a629fa | |||
| a295437e11 | |||
| 04597fb804 | |||
| f2f002409b | |||
| 509de877ca | |||
| 63aea4a7dc | |||
| 6470c748db | |||
| 25a6429e6a | |||
| 4fa1c2a97e | |||
| 9ad39d77cc | |||
| 92527126a8 | |||
| 02b4a4c974 | |||
| ede570be21 | |||
| 08627e9df5 | |||
| 6d9f3adc86 | |||
| 96433b4e39 | |||
| f4947cc2ae | |||
| 7b554d4f72 | |||
| 5b54544438 | |||
| ef78d23494 | |||
| ef8a7f330d | |||
| b72e0f3060 | |||
| 2a0bab938b | |||
| cd637629c4 | |||
| b9adfd801d | |||
| 69355514c9 | |||
| 33dc947c21 | |||
| 6de021d8d8 | |||
| 9be86621bf | |||
| a7a0876298 | |||
| 31b42345c3 | |||
| 1b172e729e | |||
| 3bf387a2d4 | |||
| 9f20bbb046 | |||
| 82af555974 | |||
| 50638b5213 | |||
| 650df95b72 | |||
| b2115a4162 | |||
| d67bf16a08 | |||
| a4c9b64224 | |||
| 8f572e5fe6 | |||
| e58873044b | |||
| 8ada92a69f | |||
| 3c8ed5c000 | |||
| c127d5b64a | |||
| 2d3bd0809a | |||
| eef955a9dd | |||
| e59ce39dc6 | |||
| 62815f5c3c | |||
| f496010273 | |||
| 143c4e3322 | |||
| e7f1e99a5e | |||
| 140a031515 | |||
| b7c91941b8 | |||
| 33f0b6da67 | |||
| ee18fe9bba | |||
| a51330cf07 | |||
| a67aed2744 | |||
| d979e19315 | |||
| 4c74d16795 | |||
| 6e541a432f | |||
| d8f47e248a | |||
| d1a869496b | |||
| f42a37555d | |||
| d9e019bd87 | |||
| ce194fa5d8 | |||
| b5bdf57636 | |||
| a3a81ce7c6 | |||
| 61f347401c | |||
| d985a4c250 | |||
| d31947e1f0 | |||
| e4659b7d7c | |||
| 8827a534db | |||
| ddf48b45a5 | |||
| 8eabb9b02f | |||
| 8a195a0b35 | |||
| 955206aaf0 | |||
| 082dd7d5ee | |||
| 90714cf624 | |||
| 61798d33f0 | |||
| 6e2a41cb26 | |||
| 515897e180 | |||
| fe4a8f33b1 | |||
| 304d848f53 | |||
| b5f738abf3 | |||
| 7ebed06393 | |||
| 2e56fe82bb | |||
| 32019c61aa | |||
| f7ffae565c | |||
| cd11bb1606 | |||
| 24c924d668 | |||
| 9be94e4b58 | |||
| 15e9d8c99d | |||
| 391f511094 | |||
| 5b53c11a6b | |||
| 9df4b6ea24 | |||
| a440564ba4 | |||
| 9583cfcc93 | |||
| c4a921283a | |||
| 4e05f087f9 | |||
| 40b506d2e0 | |||
| 263f384810 | |||
| d80c145a18 | |||
| 8848fe35f6 | |||
| 7a681bd20d | |||
| ed31fb184b | |||
| 360b94dd6c | |||
| 8524e73f59 | |||
| 940514e5ca | |||
| a4e47625ac | |||
| 7c16872a6e | |||
| 994c3c3552 | |||
| c34f496600 | |||
| 8bca8629be | |||
| 85fdd579d6 | |||
| e88d2ff88c | |||
| bdf08baebd | |||
| 3dcdd25177 | |||
| 491e8640b2 | |||
| b23b7ef85e | |||
| b167374f13 | |||
| cd1f6e733f | |||
| d3fc7687b8 | |||
| 17a83d58da | |||
| 18a8e1b6d6 | |||
| 2c23cbb359 | |||
| cdd58cf757 | |||
| a0df325659 | |||
| a59005e836 | |||
| 5da6a27e6b | |||
| ef97af71e3 | |||
| 6ed67f4532 | |||
| 1278d663b4 | |||
| 0395c7b407 | |||
| df3d15ffb3 | |||
| 6f673310d2 | |||
| 978c3eca23 | |||
| 20bc848bd6 | |||
| ce7f1292dc | |||
| d97ff8bb40 | |||
| 8a9b46d82f | |||
| 12e5703541 | |||
| 1b87fc2ee6 | |||
| ebd0c780a1 | |||
| bd976cd562 | |||
| 0e511c3e07 | |||
| 300d489408 | |||
| 024d081167 | |||
| 348173d3f1 | |||
| 23e3814f8a | |||
| b818e2c4b8 | |||
| 6adb3dc142 | |||
| 0e154cc759 | |||
| 9dce8d9bce | |||
| 0aa3b9c487 | |||
| dc7ab3ed30 | |||
| 254259b354 | |||
| 9651c70efd | |||
| 5840190ed5 | |||
| a807b88694 | |||
| 0db82e09e9 | |||
| e5865f171a | |||
| 166d198dcb | |||
| 445795f2ec | |||
| 6be4a87dac | |||
| 17c47053d6 | |||
| b4e18f7521 | |||
| fbe4d287c7 | |||
| 543fa3ae79 | |||
| 7cf855413c | |||
| f5d65dc0bc | |||
| 2f6211a1d9 | |||
| 513a57330a | |||
| 715ddf0620 | |||
| 6bb31e276e | |||
| b10f1df49f | |||
| f999519b13 | |||
| aedbf02830 | |||
| bd5479b250 | |||
| 9d14715652 | |||
| 72156fcf1b | |||
| 1c6eab00d1 | |||
| f9738c5b55 | |||
| 3b63083619 | |||
| d5d7d8bc84 | |||
| f26118cf5a | |||
| 5d6c4b475c | |||
| 2c4ef392f6 | |||
| 2a128fe772 | |||
| bb7d3ca3a1 | |||
| a2bdba7eda | |||
| e8aabc9980 | |||
| 9f554a14fd | |||
| 68a2b91ccb | |||
| 4089cc6e6f | |||
| 4e8848eeca | |||
| 8c6133c115 | |||
| 483db31acd | |||
| 35dae3dab7 | |||
| 8232aedf78 | |||
| d30a0a2e67 | |||
| d913fe508f | |||
| 4029903301 | |||
| 5db7e826d3 | |||
| 7f3e7da7c7 | |||
| 93cefde8fc | |||
| 02e7981e10 | |||
| 0ecec10af0 | |||
| 00b8cba987 | |||
| 8486bff918 | |||
| 5305eb5b8a | |||
| 377a3bb7de | |||
| 5a47e8d2c6 | |||
| 71f4cd7c85 | |||
| f7751684af | |||
| 59df1d39b2 | |||
| 7e5933e6a0 | |||
| 2cefd34bb7 | |||
| eac891dc3a | |||
| abd3599408 | |||
| 1bcd259c00 | |||
| c4e835266c | |||
| 685953f6a5 | |||
| 03fffbc724 | |||
| e1a8c932ee | |||
| 1aa2a6b054 | |||
| 1ad96c9c81 | |||
| f69199909f | |||
| d063e77040 | |||
| bf3ddeb1eb | |||
| fc261ad8cd | |||
| 90fc018295 | |||
| cdc01d9a69 | |||
| da7e76c07d | |||
| ba9118aa58 | |||
| fdce705e55 | |||
| 81268e7064 | |||
| f502f41359 | |||
| 34c9cfb6b0 | |||
| 6da1790c46 | |||
| d333c940da | |||
| c940d2906f | |||
| ac4b51ba85 | |||
| ea7a1ad2c7 | |||
| 45ddd6a68d | |||
| acd99364e0 | |||
| 14710dea55 | |||
| 5d3be8da1d | |||
| 3026821f9f | |||
| fba51dabd0 | |||
| c4da5e81fa | |||
| bc80d81432 | |||
| 67797efead | |||
| c7cb036536 | |||
| 0ccbc5f139 | |||
| 2a6bbcaf8f | |||
| d46a8438ba | |||
| cc9d19da19 | |||
| 6e6aa6fd6d | |||
| 61652a2989 | |||
| edd7503607 | |||
| c9d6dab401 | |||
| d303038bcb | |||
| 0a0e7c3b7c | |||
| 0b4ac35bc9 | |||
| c51864ca39 | |||
| a1cabd5a68 | |||
| 9c1bc99d7a | |||
| c05fedcb76 | |||
| e11beeae4b | |||
| 4749e0d71e | |||
| 1c01b77a71 | |||
| 1dd8ad3685 | |||
| d6f6350b54 | |||
| 4f3b85e604 | |||
| efd5bc24b0 | |||
| a1d5dfa1ac | |||
| 597c2ba180 | |||
| 2c2fb1b70b | |||
| fc1287659a | |||
| 1a76630594 | |||
| 322f682d32 | |||
| 0e329336fc | |||
| b33bdabbb6 | |||
| 27d30121ab | |||
| 345278f309 | |||
| 4953e77161 | |||
| 8d61e037f9 | |||
| 33a51e69bf | |||
| d5dd9bbf24 | |||
| 8772e52513 | |||
| 9e1631ad4f | |||
| 134b829d59 | |||
| 3df7d26101 | |||
| cf56086f06 | |||
| a72aca4379 | |||
| edb0b7519a | |||
| 3a3248c88c | |||
| 3f14b9dab7 | |||
| b1c07c22ce | |||
| 3b2c411274 | |||
| e418af1ccd | |||
| 7dc004acb3 | |||
| 2635472896 | |||
| 5c0340f9ae | |||
| c2c970ee33 | |||
| b52dabe091 | |||
| 3fa2db8d6f | |||
| 1e7950f671 | |||
| 8fde05191a | |||
| 2557de6c4e | |||
| 44328aee76 | |||
| f606b5879b | |||
| 83607119df | |||
| 9b86e68268 | |||
| d688a05ac7 | |||
| 97e975b4f6 | |||
| 9dd0e3ce4f | |||
| ca2293f6d3 | |||
| 0cd1ef0c7a | |||
| b0207ce524 | |||
| fab0c3b09d | |||
| 8b35dd3358 | |||
| cadcbb27eb | |||
| 297d44c614 | |||
| 22178f2224 | |||
| 554f8a376c | |||
| 4157affbd7 | |||
| 4b991203df | |||
| 38a265741c | |||
| 56eb02280f | |||
| ed900b0476 | |||
| 42206364e5 | |||
| 82d9bb8f51 | |||
| 923a9d3f9b | |||
| ae7660068b | |||
| f466c1d764 | |||
| 6e76f8ef3a | |||
| b3a8d02caf | |||
| 022ba32c1a | |||
| 8f5e89c900 | |||
| d335d7bafd | |||
| 1f51ef7df6 | |||
| ec082ee023 | |||
| a6bc271e0d | |||
| 791fd9199e | |||
| 9e8baf1914 | |||
| 64b7080532 | |||
| 8fd5479f32 | |||
| 04eb9c02c3 | |||
| 07b41b9bc3 | |||
| 8ebadfafe9 | |||
| 3283896e4b | |||
| b444bcf418 | |||
| 13034577fc | |||
| 9feefc2e7f | |||
| a5393e985d | |||
| e3fe0dc89b | |||
| 42d49e9d50 | |||
| 06eb244800 | |||
| 870cdfa51f | |||
| 93787c74ee | |||
| 945323fe15 | |||
| 5e41e69b27 | |||
| 9d14185f7d | |||
| 0f74162551 | |||
| 00b1ff1ff6 | |||
| 977024ea94 | |||
| 3534ed21d7 | |||
| ee093e5232 | |||
| 807ab8d19f | |||
| 81f3ff098f | |||
| 85a5759afb | |||
| 490e7a56a5 | |||
| e41c475671 | |||
| b0841268bd | |||
| b9b3b67b95 | |||
| 0d57d2cfe3 | |||
| 32de5d0d7f | |||
| 51eab2a4b7 | |||
| 93cf170253 | |||
| f7554374ab | |||
| b4870f62c9 | |||
| f1d713ebf6 | |||
| 4134a512b9 | |||
| cf998f945c | |||
| a7386238dd | |||
| 6b39d122a6 | |||
| a0582c5380 | |||
| 1f37112969 | |||
| 361958db76 | |||
| 8bc7880b19 | |||
| ceddf29586 | |||
| 3fc78e21bc | |||
| 48e00b371c | |||
| aee52d3880 | |||
| bd54499537 | |||
| e6da9e8d1a | |||
| 156ca03b67 | |||
| 3f4419b177 | |||
| 676f860d7d | |||
| 5ce93ae0c7 | |||
| 43231826b9 | |||
| 899b393fcc | |||
| 5c3e02d2f0 | |||
| a29064107e | |||
| 4cdc969801 | |||
| 68159d457e | |||
| daafc29d2b | |||
| 3c786acf2b | |||
| 53c3817d4d | |||
| 9109254488 | |||
| df19f0d5ec | |||
| 093362e479 | |||
| 7826a3652b | |||
| c27b7e52e1 | |||
| 6f79cbb2a6 | |||
| 6f33929f91 | |||
| 2e8b649195 | |||
| 3841be7e20 | |||
| 2c28521283 | |||
| 1c735cc204 | |||
| f0b13ae8e4 | |||
| b1a2f8fec0 | |||
| 83828aa8a3 | |||
| 4eb81b4d66 | |||
| 96d9968db5 | |||
| 2781e37ec0 | |||
| 6d61e773b5 | |||
| c5171114d1 | |||
| 0ca0a832de | |||
| aef54a4bfd | |||
| 4c473acfec | |||
| 0de41e97ac | |||
| 0e52ab3f90 | |||
| 797679b42c | |||
| 1bc8b6f46e | |||
| f322b580ff | |||
| 2b2f33e3f5 | |||
| ce29cd2fad | |||
| 0d5843f44e | |||
| e36e8e3b33 | |||
| e251a1ca19 | |||
| 4aedb00e43 | |||
| 10a0469221 | |||
| d3419acada | |||
| 65ea4117ca | |||
| 8b0101dcab | |||
| 188f67cfca | |||
| a89f4bd4b8 | |||
| 053c9dc0e1 | |||
| 493d9f1b9d | |||
| e28793f128 | |||
| ea2bddf245 | |||
| 763b3c05af | |||
| 473cfb54be | |||
| a7fd742c17 | |||
| b66ba140cb | |||
| 242f606a29 | |||
| 60a1214d7e | |||
| 189ab8c8e8 | |||
| 3765ca4e92 | |||
| df87d76070 | |||
| 8fbf0b406b | |||
| 633073803f | |||
| 104da198d3 | |||
| b3121e4534 | |||
| 3bb654cc85 | |||
| d2830db94d | |||
| ad6914b938 | |||
| 57ba965b93 | |||
| 544ec21fc2 | |||
| 1bb0fa1809 | |||
| ffa0efc898 | |||
| af6b4b8c27 | |||
| 3f7c1f966b | |||
| 535515f296 | |||
| 7af6c4b10e | |||
| 2076bef95b | |||
| 48ce1f1814 | |||
| 5151c8a505 | |||
| 44248f19b5 | |||
| 8d433f2580 | |||
| 272fe5488c | |||
| c97765de14 | |||
| 7acf150ac5 | |||
| 077bbdfc78 | |||
| 2fb38ce13a | |||
| 22dc183f25 | |||
| 3c492c3fc7 | |||
| d71db2978e | |||
| e4723e0bad | |||
| dc56c4e530 | |||
| 9579a51a8b | |||
| 71f897ebf5 | |||
| 09d9f71ae9 | |||
| c678ccdfb1 | |||
| bbbebe343b | |||
| 033cb4f0c2 | |||
| d750034b79 | |||
| a2063f0628 | |||
| acf2f2ffc4 | |||
| d14f484c4b | |||
| 695e515a65 | |||
| 61089feee7 | |||
| ddc9b10cd3 | |||
| f95c92b431 | |||
| eba65a94e6 | |||
| c28a0c6bb8 | |||
| d6bacd9b47 | |||
| 70b1657323 | |||
| 1ef08bd169 | |||
| da68cc6a78 | |||
| 45c75d42ad | |||
| d4e55af2c2 | |||
| 48791a329d | |||
| 9b26ebed75 | |||
| e2160fb6c9 | |||
| 345a1c64f9 | |||
| 7ad1e7756b | |||
| 90caf19e9e | |||
| 8d0b3b7d44 | |||
| 4c253d68d4 | |||
| 73d1b331f1 | |||
| af2fddfd6d | |||
| 3e065ead65 | |||
| 3774704326 | |||
| 4a1100b6a4 | |||
| 63dec77ed6 | |||
| 1d3a66f890 | |||
| c1da92ca22 | |||
| 13475002d7 | |||
| 5bb6f246ed | |||
| 89df7451ef | |||
| 1334d544f7 | |||
| 3fefaa7362 | |||
| 15d62f7b96 | |||
| 83e0aaa511 | |||
| ee06ce1148 | |||
| 16d6124bb4 | |||
| 1197beaa13 | |||
| 98b428a8be | |||
| 17f47d3c0a | |||
| a9cc3b2a89 | |||
| 199102c106 | |||
| c7d76fb7ab | |||
| ba9b86c0dc | |||
| 5de83a606e | |||
| 01a0c8672d | |||
| fa522c0ffc | |||
| 16241d010f | |||
| 9cb8fbf178 | |||
| bd7ef27628 | |||
| 42e520e841 | |||
| d8f9cd237f | |||
| 33065ecf04 | |||
| 718a1da262 | |||
| b89c3ebb42 | |||
| 9d7e44feff | |||
| e48a60a4f0 | |||
| 163e1907a4 | |||
| ac1ccaa246 | |||
| 53b45279ad | |||
| f80daf5de1 | |||
| 298ea1f0d3 | |||
| 1d13d8c4a0 | |||
| 2238c99b61 | |||
| 7d4dfbef2b | |||
| 759827b404 | |||
| fca627d1b0 | |||
| 404da18aed | |||
| 330fca722a | |||
| 8939cd120b | |||
| 63afeb7373 | |||
| 6ba68a6455 | |||
| 1579c74302 | |||
| 373ca15c71 | |||
| a8a3caed1c | |||
| cb35ba4543 | |||
| cdd152d015 | |||
| 83ce7dc62f | |||
| b182b50f24 | |||
| 71a9941b84 | |||
| c777da263e | |||
| 2cb7b56a41 | |||
| 52f9ef14b9 | |||
| 8d6c594240 | |||
| 7ad77ff540 | |||
| acede72e9b | |||
| 771fd732d1 | |||
| 2a79a69f59 | |||
| 8c0321697f | |||
| 0151b3f9b3 | |||
| 82a51f35ea | |||
| 35944cbfc1 | |||
| f0aef9b28b | |||
| ae37c3902c | |||
| d612585582 | |||
| 7ca14d209c | |||
| c37f582c10 | |||
| 6272fb3822 | |||
| 2582fbac59 | |||
| 5abb578e47 | |||
| 015ebf89a5 | |||
| c6724968f1 | |||
| 9fa1772ae4 | |||
| 4551937812 | |||
| 51ee664cae | |||
| fb611a98f9 | |||
| a3d5face38 | |||
| 424cd497d3 | |||
| d46eeffaaf | |||
| 6520f2061e | |||
| 5d93f86b4b | |||
| b3f63ce7ae | |||
| 56de770682 | |||
| 940341bc9d | |||
| 804a0ce601 | |||
| 41054a4c56 | |||
| 7b8e5d4180 | |||
| ca2369f1c1 | |||
| 129cb0b3cd | |||
| 632b2ae1ba | |||
| 18e55061e1 | |||
| e49b65723f | |||
| 8e52894763 | |||
| 07cba6c774 | |||
| 9cb639b505 | |||
| 4cf6eeeee2 | |||
| c0f692792f | |||
| bd77e0945b | |||
| f0eb171b2a | |||
| fb93662b5c | |||
| a26c982e93 | |||
| 7db3e98944 | |||
| 4a87834e04 | |||
| bf6ecaeeb9 | |||
| f70ef86dfa | |||
| cd3132667a | |||
| 1c459a7bea | |||
| 4f0bfeab4c | |||
| c5c9921b59 | |||
| 6b63aba1fc | |||
| 382331fb11 | |||
| caf9af7ae4 | |||
| 45d2adeb9c | |||
| 96708d7592 | |||
| 13090d1219 | |||
| 8ab229cca9 | |||
| 583cd078dc | |||
| aa2ac1bbb8 | |||
| 928b426672 | |||
| 6766b14415 | |||
| 9d0f9e967f | |||
| d7609088e5 | |||
| b2643b6926 | |||
| 07b65ca069 | |||
| 25727f7f99 | |||
| 880ae89307 | |||
| 1496df1989 | |||
| 7d8ae6b4b1 | |||
| 312d4cccaf | |||
| ce5f9f95ea | |||
| d9bf8a76d9 | |||
| f7a35fb9fe | |||
| 3ba691ded5 | |||
| 7a7277d56f | |||
| 76be5dd1d3 | |||
| 53dc63f3bc | |||
| 80da0bc9d5 | |||
| bce7af4e11 | |||
| 9da09b51ed | |||
| 86392f197f | |||
| 1c13046297 | |||
| fbc756b531 | |||
| 6c64b06453 | |||
| 241834029a | |||
| 5b8a9c0b47 | |||
| 037c29d24a | |||
| 893f26ac9a | |||
| d43f8e3100 | |||
| 2b42acf7b8 | |||
| f65b80ed42 | |||
| e84abbdc82 | |||
| 66269eabe9 | |||
| 36c0928483 | |||
| 9237e15adc | |||
| 0d3a2072b2 | |||
| aa2ee5dfc2 | |||
| b515fa39ec | |||
| 76e3f4eb92 | |||
| 4959e5c6c2 | |||
| 7082594bbc | |||
| 36dd35f238 | |||
| 9c9fb6a485 | |||
| 5438a4837b | |||
| 84996e8cb6 | |||
| 87a368a857 | |||
| 21412d93dd | |||
| 0b11ff22b4 | |||
| 8fafa78796 | |||
| c43158f8a2 | |||
| 92ad524947 | |||
| b362a61863 | |||
| 468fec38d7 | |||
| 89830a5ae0 | |||
| 5977c296bd | |||
| 47d5792d97 | |||
| 25d706a913 | |||
| 048236aaaa | |||
| d442c58fd1 | |||
| f890f6bb09 | |||
| 036d466790 | |||
| dee47ba2d8 | |||
| be96c28b77 | |||
| ad1c0f578e | |||
| c8f7b1b72c | |||
| c89702ae84 | |||
| 2d29a82250 | |||
| b36c65e654 | |||
| 09b072b908 | |||
| 0ae9fee350 | |||
| 1579182ed9 | |||
| 074671aa71 | |||
| 36b7c47247 | |||
| 424d5b3025 | |||
| 8a5d352733 | |||
| f383629282 | |||
| a6d717cb04 | |||
| 84a5753301 | |||
| 5d2d9c7e81 | |||
| 82801d1411 | |||
| 340c3963d8 | |||
| ef15cf9847 | |||
| 4d613ccfa7 | |||
| 43ce34d547 | |||
| eda074cd80 | |||
| a2396d82f6 | |||
| a38721db93 | |||
| a06e811717 | |||
| 86e534ff75 | |||
| 640d5b2dec | |||
| 57e9b27085 | |||
| c56eefc739 | |||
| cf28306997 | |||
| 10acf3ddd1 | |||
| fed3ed9f9a | |||
| 260138ba11 | |||
| 67f7e0089c | |||
| d4a22c7851 | |||
| 06cf986490 | |||
| adf9aa04ce | |||
| 69f66fbe52 | |||
| d061005c89 | |||
| f6ee8b9f04 | |||
| 31af22c2ff | |||
| c421e3f243 | |||
| 6e92902407 | |||
| 6256381dc3 | |||
| b247b051ea | |||
| afbd553622 | |||
| 36bc14e884 | |||
| 9c5d0ff2ff | |||
| cfa6c8ddf6 | |||
| 21924bf022 | |||
| eea33f6019 | |||
| 66d48ae808 | |||
| de9b9fd0b1 | |||
| ece7384be4 | |||
| 0c052e4506 | |||
| 1996a0a3d6 | |||
| 679ad9b8c6 | |||
| d4983731e7 | |||
| 4fec3c8f34 | |||
| 836fd2565f | |||
| 54618064a1 | |||
| 519e3e01ae | |||
| aec8f81358 | |||
| c1d6bf4366 | |||
| 9bf2b79d9e | |||
| 4d98408995 | |||
| 7b466388f9 | |||
| b926fb3c66 | |||
| 6c8d5c0d0e | |||
| 5a1d234260 | |||
| fd6d42c297 | |||
| 7310ad6e92 | |||
| 7e47b1348d | |||
| 1e3555a6b7 | |||
| 9a67ce5968 | |||
| 279d7955f8 | |||
| db977c0bf5 | |||
| ba6bc59818 | |||
| 6e8be0578c | |||
| 92f7d16b5e | |||
| 40bb3c2f5e | |||
| 56a6096221 | |||
| ee37b42a91 | |||
| 0806e61df4 | |||
| 279ffeeefa | |||
| 80c5ee2479 | |||
| 16208544e5 | |||
| 6afeb24fdb | |||
| e6357b81eb | |||
| dfc2efe8a6 | |||
| f28b96f431 | |||
| a10293f8f7 | |||
| b1f02f91d7 | |||
| e76fa45d86 | |||
| 06f43892a5 | |||
| a094332b0d | |||
| 7b8779f534 | |||
| 371bf20d19 | |||
| 0f633ddd15 | |||
| 7886ca7f5f | |||
| 9b4c11954d | |||
| a1b724f30a | |||
| 7c3b2fb9cc | |||
| acef68d67e | |||
| 7e393d5f1e | |||
| 955c31b165 | |||
| e307cd48ad | |||
| 25f8b9e451 | |||
| e8ba14a2c1 | |||
| 9670d3341c | |||
| cec9778fd5 | |||
| 7451db4a68 | |||
| e31777ec53 | |||
| 7aa0b3dc7a | |||
| e7b2d5dc01 | |||
| 47d728667d | |||
| e1f8989d54 | |||
| 1d8cb47830 | |||
| faaa7c37a9 | |||
| 0aff9d8df4 | |||
| 30c3f8c1ac | |||
| bcd2469e01 | |||
| 983c6ae73d | |||
| 6d8e1fe776 | |||
| 99b4921309 | |||
| 3c231c3c9e | |||
| 175c0a6236 | |||
| 0031ceb06c | |||
| e3cc5a63df | |||
| 3cb61402c2 | |||
| 5336c51199 | |||
| 52aa658aaa | |||
| d08a51d7e4 | |||
| d97a557ac3 | |||
| 8a68d9cded | |||
| b031f7e902 | |||
| 963ffecb96 | |||
| 8f8aaca818 | |||
| 801f92b7e7 | |||
| 44db45700e | |||
| 25902005f6 | |||
| ffec71e0d8 | |||
| 99a208110b | |||
| e56799c993 | |||
| 957eb300f8 | |||
| 626025d539 | |||
| 9e8a0a020f | |||
| 40f592eade | |||
| 5e899f0be4 | |||
| f2748284b1 | |||
| a15ce00934 | |||
| 9e3e80261b | |||
| c72c685434 | |||
| 0177a8d277 | |||
| b6a9b0a4c9 | |||
| f4f8bd8d42 | |||
| 6e4aeffc0c | |||
| dba256d384 | |||
| 910008e9e7 | |||
| 8cb9545c41 | |||
| 59c16da6fb | |||
| 630df5bbd2 | |||
| f550111400 | |||
| 77377195aa | |||
| 7e2e72bd40 | |||
| aa7a13bd02 | |||
| 5895058a17 | |||
| ffb60d5149 | |||
| 1e2cb279b0 | |||
| e7f766f5ba | |||
| 8de5aa9409 | |||
| bf28a4df49 | |||
| fe1a0ab371 | |||
| 01daccfaf7 | |||
| 94e861e298 | |||
| d36af2ed5c | |||
| 7104b33214 | |||
| 32998e5377 | |||
| af0c9ef092 | |||
| 3bc3b3d10e | |||
| f03f42ca4d | |||
| 79783abeb1 | |||
| 895b0bd602 | |||
| 2ee5ee92f8 | |||
| 3e619423b1 | |||
| b524e18bdf | |||
| 6aa4579db8 | |||
| 17fb86c0f1 | |||
| 62ecfe4873 | |||
| 04e55e6b9a | |||
| f432aa1090 | |||
| 7add104313 | |||
| 36de249066 | |||
| b7a54dcffd | |||
| 6bb28deab2 | |||
| 7f88d15c86 | |||
| 94c5014e23 | |||
| c5a8256500 | |||
| 5f39884bf7 | |||
| d96825a242 | |||
| 443a938091 | |||
| 6bc3197721 | |||
| 269cc91fd5 | |||
| c1ddea479d | |||
| 5f3a95962c | |||
| ee1a8e6a32 | |||
| eeae73296e | |||
| 4ca8357af4 | |||
| 8a5b8c87fb | |||
| 6ab04d7bbc | |||
| a5a1380636 | |||
| eeab1aef64 | |||
| 4e1c342e55 | |||
| d8ed259bce | |||
| 9f6cb5de4c | |||
| ba634118d7 | |||
| 63da091d36 | |||
| ad0dc88a33 | |||
| 147acf4b57 | |||
| 5085f3a15e | |||
| 22a95ad8ea | |||
| df4bd6a60c | |||
| 813e7b05e4 | |||
| ab8b486b4a | |||
| 590f666ec9 | |||
| 9adaee915b | |||
| bce0f06fe9 | |||
| 856ecb84a0 | |||
| 90ddc06c98 | |||
| 405abc4e95 | |||
| 549c59ecf5 | |||
| 0a485eafcb | |||
| e0c11956a6 | |||
| da6a9bf3eb | |||
| dacd11e1cc | |||
| fc854b4c77 | |||
| 4dcc1f0374 | |||
| fc57390242 | |||
| bd15ef0a0c | |||
| 967ecafc33 | |||
| 29576da985 | |||
| 200a2556ef | |||
| ae0ab5025e | |||
| aa74276b25 | |||
| b03112a5dd | |||
| a3f49df62d | |||
| aa2af3f6dd | |||
| 20dcbc593c | |||
| 472ba8c1fd | |||
| d8345a44a4 | |||
| a187cb6c9c | |||
| b89c0b35d1 | |||
| 7ffcc0a5e7 | |||
| bde43fbdfb | |||
| 3728b2208f | |||
| dc52a756ee | |||
| 98dc886841 | |||
| d0cf104e43 | |||
| d7ed2412f6 | |||
| 7d38f0e234 | |||
| 3e8d072d24 | |||
| 84ac771893 | |||
| 3a9e0b5be6 | |||
| 9694ff433f | |||
| 2e82e78b98 | |||
| aaef4bee27 | |||
| 4ca8569488 | |||
| 8377ada3e0 | |||
| 8a034d59ed | |||
| 8e492d8798 | |||
| 7974ef80d7 | |||
| 3664d86430 | |||
| 9adef80d6b | |||
| be57adaee7 | |||
| d117e442a4 | |||
| 8820bc0796 | |||
| 57a64de023 | |||
| 5ed689ceb0 | |||
| 25f1765f36 | |||
| 063bd58802 | |||
| 901c6b34fa | |||
| 5b2d6488a2 | |||
| f6f35415d1 | |||
| 6c6069e963 | |||
| 6219d82560 | |||
| 1dcd7a16ab | |||
| b60caeb9dd | |||
| 4c4768aaf3 | |||
| 2f4ac0a663 | |||
| 23a446f852 | |||
| ec48334a1a | |||
| f4c061d412 | |||
| 31a076d7b3 | |||
| 6bd43d986c | |||
| dd32a2f15a | |||
| c88c20820f | |||
| 86de510731 | |||
| 0b31fbf827 | |||
| 34ad1450eb | |||
| e6ba71390d | |||
| f0c8dbe0ec | |||
| bf046a8ccb | |||
| b05ba7683e | |||
| aedf8dad15 | |||
| 74ebb7c722 | |||
| 1307f66494 | |||
| 448a24cb36 | |||
| 7266f23450 | |||
| c0ad31acfc | |||
| 25d3a0de27 | |||
| 1e38bbfbc1 | |||
| 1c62e95812 | |||
| d453cc27a3 | |||
| 2c3e841d8a | |||
| 50668c462f | |||
| 8d1192e832 | |||
| 4a8e2e9ed4 | |||
| 12fc45220a | |||
| 6bce68fbe7 | |||
| d54f947c98 | |||
| 6c8bb3a22e | |||
| ed29ce5183 | |||
| a51d269b7c | |||
| 8283e4e6d6 | |||
| 23ce91eb55 | |||
| 545ac7fcfa | |||
| 3926ccccad | |||
| f431307ef2 | |||
| ca368e0f9b | |||
| 8afeb56c11 | |||
| 2a6f90c5f3 | |||
| 271031128e | |||
| b991f954d0 | |||
| f12bb3f80d | |||
| 6dc978e8d8 | |||
| 9f05a873bc | |||
| 703d498772 | |||
| ed3b9543bb | |||
| fc7efba7d8 | |||
| b3178fe8f4 | |||
| e36798a993 | |||
| a143605465 | |||
| d3ad35b21e | |||
| 68134941bf | |||
| 54d0fef559 | |||
| 7f9c47176a | |||
| 9060ac7897 | |||
| d9073e4a17 | |||
| de1c1d7cc2 | |||
| 6ff1bd5917 | |||
| a6b04f426e | |||
| fa49dbe2cb | |||
| 682eb04a52 | |||
| 77064fb09e | |||
| be8d93563a | |||
| d4a6a5216d | |||
| 1cb1427050 | |||
| e4f4eace1c | |||
| 30a98b7e8c | |||
| d36c8d95ad | |||
| 506bd0abcf | |||
| 8dd810c41d | |||
| d9d0dc5201 | |||
| 72880d9e03 | |||
| 6c7ec6eb1b | |||
| 705fc5d116 | |||
| d20b575b9b | |||
| c949beab9c | |||
| 3fb857c435 | |||
| 0a4f999ade | |||
| f0b7147881 | |||
| b36a42cd0a | |||
| 000309b47f | |||
| 5cb12988f0 | |||
| 50c4b749ec | |||
| 5db2734e6f | |||
| e9e5507483 | |||
| d63dc7adfb | |||
| 27db44a8db | |||
| 1a035e2866 | |||
| 887aa20116 | |||
| 5e03d86695 | |||
| 95075aa28e | |||
| 0260f0790a | |||
| 34d65ba292 | |||
| 27a77a15ed | |||
| 76025bfae1 | |||
| 4957faf482 | |||
| 0d8e16d5c8 | |||
| 07baed1581 | |||
| eab5da075a | |||
| 0d1bbb19ce | |||
| 58d6cbc6ac | |||
| 4d3b627839 | |||
| 49455c99ad | |||
| 31bb6bedbd | |||
| 8d54678ea1 | |||
| 590767c299 | |||
| ec1bd342b8 | |||
| b031c9e7f6 | |||
| ea0dfe83b7 | |||
| bdd90f2c57 | |||
| 288dac5d70 | |||
| 9d22e1c35e | |||
| ace2359e7b | |||
| 617e6510a5 | |||
| 26024770b8 | |||
| d556f58e34 | |||
| b6f302dfc0 | |||
| 8e9b5f14af | |||
| 3635c00143 | |||
| abc71baaa6 | |||
| 959aaebede | |||
| d17f8c5049 | |||
| 42a7201a70 | |||
| 1f1744a49a | |||
| fd7dbe5bd9 | |||
| 984549400d | |||
| cf0c49277e | |||
| 16c3f9fa9c | |||
| 2f2539cf34 | |||
| e66823d017 | |||
| 881c32a3df | |||
| ea0a361c35 | |||
| dc60f8bb7b | |||
| 9e92c9ea12 | |||
| a503a54240 | |||
| 265957712a | |||
| c26962bb71 | |||
| a428eddf93 | |||
| dc4f7eb2f9 | |||
| d54ac1ba91 | |||
| a3d46b18ac | |||
| e81dd05666 | |||
| 29394935e3 | |||
| df8acc4ed7 | |||
| 81928d4ab1 | |||
| 3ebf93e03d | |||
| 59e4032f1f | |||
| 8f15777427 | |||
| 748c4bf780 | |||
| befcf6d2b3 | |||
| 48236ecd3c | |||
| f340f84de7 | |||
| 40e19293f9 | |||
| f252f824a4 | |||
| 1d7e5a8130 | |||
| cb2ff92c2f | |||
| ef373ab54f | |||
| 9141a78c29 | |||
| 10a6370738 | |||
| 573009eeb6 | |||
| c3363712d9 | |||
| faa33d89a2 | |||
| f347458c53 | |||
| 530e6d9196 | |||
| b398e18e12 | |||
| 747e8370e0 | |||
| 2c67875781 | |||
| c96e8a8c19 | |||
| 5f203fc082 | |||
| b943c9b471 | |||
| 1a90a1daa8 | |||
| 72dfc743fd | |||
| 465307655b | |||
| 6ce71e6694 | |||
| 7f01b3b92a | |||
| 76950d56b9 | |||
| c11e0d02b3 | |||
| 4c798c1718 | |||
| 450d7e9ad4 | |||
| b8ab79c83e | |||
| 6934bdd533 | |||
| 84dedb73a5 | |||
| 8964aa5221 | |||
| 3481ae236c | |||
| 46adc5f8a4 | |||
| 5296df5899 | |||
| 13dad4be16 | |||
| b5d0c343b4 | |||
| b00b945264 | |||
| 3bda09e105 | |||
| 32d32c4e4a | |||
| 497441b54e | |||
| 9c564fd4c7 | |||
| 0c2263d0e9 | |||
| 3d4d30766d | |||
| 99d84d44fc | |||
| 41ba7077ad | |||
| 8a929a91c3 | |||
| 0604f06841 | |||
| 229924adf9 | |||
| df988b7c69 | |||
| e8106e2e34 | |||
| c21d3e24f8 | |||
| 2d87aa0753 | |||
| b2ad4dc9a0 | |||
| 370f2ea98f | |||
| a05ca565ff | |||
| 52255637f2 | |||
| 0fcaa3a2f5 | |||
| 0e2fa6eb9d | |||
| 1aac462c83 | |||
| 2a0edfd8f7 | |||
| 1f59a9f846 | |||
| 80c20a90ea | |||
| 56a35649fe | |||
| f07cea0b79 | |||
| 4c1b08a281 | |||
| 117f9eddcd | |||
| 7bbbfce482 | |||
| f37a7811f9 | |||
| 9173c10239 | |||
| 318b31550d | |||
| c18ebc63a6 | |||
| d704694272 | |||
| 1cfec3bdf7 | |||
| fe6ea6bc10 | |||
| d29c8df45e | |||
| 71f996af95 | |||
| d9722ad6b3 | |||
| 398fd8028c | |||
| 1345a3cfd3 | |||
| 7eb0b195b8 | |||
| 009caee82d | |||
| 3bdc805a22 | |||
| ac457792b4 | |||
| 1377b54b9e | |||
| 66418ffc8c | |||
| b4c4b1fb70 | |||
| ffe4a4b047 | |||
| 753ce45310 | |||
| fece0d73e7 | |||
| edce076e68 | |||
| 675d0a009a | |||
| 5d41b5a4db | |||
| fe53b135eb | |||
| 5b1c154ee2 | |||
| 816d882611 | |||
| 12bcb09051 | |||
| c59c69a85f | |||
| bdd0daaf6f | |||
| cfad7c8356 | |||
| b2b8a128d0 | |||
| 1cfad80ca2 | |||
| a5a80e41b8 | |||
| 152f8e92bf | |||
| 0323560b49 | |||
| d3bc84a2f7 | |||
| 8a82c259bd | |||
| 46009c7658 | |||
| 6f760308bd | |||
| c346f8f17d | |||
| af1d059fff | |||
| 5562b21a20 | |||
| 8f68f31877 | |||
| ce7e94030c | |||
| ccf5a1b972 | |||
| 0d5ae77efc | |||
| 1695096d18 | |||
| 6db0b7cf18 | |||
| 575b43b0d4 | |||
| 7b39b05894 | |||
| 8bea9e0a5e | |||
| 2255b32e45 | |||
| b62573ae8f | |||
| 44ed84f5cf | |||
| d008c834be | |||
| 2d3a914aee | |||
| 7324f4c3d1 | |||
| 50c8860a50 | |||
| 6456de7188 | |||
| 23c629f2aa | |||
| 2bf154f74f | |||
| b598ad1bc0 | |||
| ace24ad68e | |||
| 750c1a0f27 | |||
| 52d89bd66b | |||
| 8cfb9d35e9 | |||
| 2f529158a0 | |||
| 6e68ab6d9e | |||
| 7a3c55af35 | |||
| fb39d6304a | |||
| 4cb57d9059 | |||
| 42d69bd0e5 | |||
| f27b399f81 | |||
| a545a3938f | |||
| d1e352c9ee | |||
| 99be1e798b | |||
| 2132a28a17 | |||
| 8b1cc28783 | |||
| 78364ac830 | |||
| 6e5f5732b5 | |||
| 87844254d1 | |||
| 08ef9f69fb | |||
| 5fbd1b78e7 | |||
| 39f5eb753f | |||
| f4cbe3f300 | |||
| 70632e5541 | |||
| 0bba700105 | |||
| b71aaccff3 | |||
| 7271ae9611 | |||
| 6e32dff2ad | |||
| 8f7c898c08 | |||
| f4a9815f48 | |||
| 0f8d5c7e98 | |||
| 5e83596a1b | |||
| 6361213e07 | |||
| 9c59a5d9b6 | |||
| bb04844bd5 | |||
| 0b988176fa | |||
| a354f18a2d | |||
| a7ca0fec88 | |||
| 06eec508df | |||
| 10dc580a3a | |||
| 2f6ae3ef01 | |||
| 392e803905 | |||
| 83a5fb585b | |||
| c6205ffbe0 | |||
| c04737ce20 | |||
| 11b92172fe | |||
| 3a6c574376 | |||
| b21ce925fb | |||
| de9dcc4ed6 | |||
| 9e77dbfe20 | |||
| 4cee0676a4 | |||
| 8ad9d21db3 | |||
| 8ba8317eea | |||
| d221187f24 | |||
| db54ec294f | |||
| 1d39796e3f | |||
| cd6a318903 | |||
| 73090b98ab | |||
| 745de1abab | |||
| 961031efc1 | |||
| 2487595778 | |||
| 5c4863d504 | |||
| 5e3a658932 | |||
| cb4704c821 | |||
| cc0b7d1492 | |||
| f8ebbf8b08 | |||
| 8795f60bf1 | |||
| f00c0a9436 | |||
| 767bc71870 | |||
| 4c068e3e00 | |||
| 277d862172 | |||
| dbed6a47bb | |||
| 94f3749784 | |||
| 728e6d851e | |||
| 11e863545f | |||
| dde49f0bb4 | |||
| a37a75aecc | |||
| e43e3aeb1c | |||
| a8fe529814 | |||
| d9f5e2bb08 | |||
| dfa83b0ac8 | |||
| bd5cef1411 | |||
| cd70b48831 | |||
| 50ebf8088a | |||
| c5cfb7eb40 | |||
| bccaafda6d | |||
| bf0086d7b5 | |||
| 7e65938ca6 | |||
| 112eff2509 | |||
| d7837d9179 | |||
| 6cdd057f80 | |||
| 5a03b213fb | |||
| f270213246 | |||
| 2e1795c5ba | |||
| 732d6710d3 | |||
| edf384d2ee | |||
| c307640826 | |||
| a77b598f82 | |||
| 217420cfa5 | |||
| f2b9dff596 | |||
| ae945ed315 | |||
| 770c153c76 | |||
| 29c4a7e606 | |||
| 8875470b37 | |||
| 6e52364bcb | |||
| 7015d616b4 | |||
| 92e6da3260 | |||
| 9220b6f1d5 | |||
| 1d0d538d0c | |||
| 83052eafae | |||
| fa95c3c4a2 | |||
| 665dcf221b | |||
| 8f73dbd253 | |||
| 826312cbad | |||
| 72a18f2b3f | |||
| a6b5e3d0ae | |||
| 1b321f4fa3 | |||
| fbde0b9f35 | |||
| 0e5f5e54cc | |||
| cbb5902066 | |||
| 92ec1b0598 | |||
| a62fc3abff | |||
| 08f8e55446 | |||
| 68f54a3247 | |||
| 29c099fe56 | |||
| 76b81c7b35 | |||
| d6b33ffd6b | |||
| 16b9873fa8 | |||
| ba4a686d1c | |||
| 4be3d79e12 | |||
| 2569b09dbe | |||
| 5d71e69941 | |||
| 16163bf20b | |||
| f1a97fecbd | |||
| a050f82f0e | |||
| ef7beea334 | |||
| 3f4acb33f9 | |||
| 14822e6395 | |||
| e82db4ed38 | |||
| 87b7ea9cf3 | |||
| 787b1fceff | |||
| 140d6ad839 | |||
| 46e8e22236 | |||
| c386db2b33 | |||
| 8dad091c6b | |||
| 3365ccbb9c | |||
| 2ced230965 | |||
| 989d10a3e1 | |||
| 62d8c69774 | |||
| cf704257b0 | |||
| a6cb6f57d3 | |||
| 141c703ed5 | |||
| 796d58867b | |||
| 2f483ec8e8 | |||
| e338918773 | |||
| d9effc58cf | |||
| 05d03f97fc | |||
| 03e891c0e8 | |||
| 4dfe9d52e9 | |||
| 9e65692b69 | |||
| 0687c9a57a | |||
| ffe1287016 | |||
| 75b7e7260f | |||
| d631e081bc | |||
| db5843d904 | |||
| 5ec16153f7 | |||
| 8c873ccdc8 | |||
| c95088f8d5 | |||
| 519fa55df7 | |||
| b8dda033ed | |||
| 0359e9c5c7 | |||
| d822b4a62a | |||
| d9e8c953b1 | |||
| 9eca502026 | |||
| cd0efe3edb | |||
| 8146e9cbcd | |||
| 5d95275024 | |||
| 49a97eea4b | |||
| 36e9c27e9c | |||
| 6e5153cd07 | |||
| c73da864c8 | |||
| 071bb75700 | |||
| 99374de340 | |||
| db7ae4ed5d | |||
| e61f481881 | |||
| 396a3ad2fc | |||
| be235ddc38 | |||
| 9e72ecd93d | |||
| 8e0bd936eb | |||
| 9d0270dcd6 | |||
| 713415c354 | |||
| 786550572e | |||
| 46caeddc81 | |||
| 71bfde2bfe | |||
| 76771b845a | |||
| a74e239e28 | |||
| 6e763b0b42 | |||
| 2f41ece017 | |||
| 01cd5fe0d5 | |||
| ed12ff7bb3 | |||
| f1386bb60d | |||
| 417bd06e76 | |||
| 91e46e3cf8 | |||
| deb5139c4d | |||
| 862ac5d014 | |||
| 028235d421 | |||
| 143d399849 | |||
| 375f171e47 | |||
| 387edcf4b2 | |||
| 011cd37cfb | |||
| 0d4254f319 | |||
| 4c407c2850 | |||
| 829e2d6c5d | |||
| a31c4bd474 | |||
| 17f24dc377 | |||
| de3e9f2809 | |||
| 4442a282e1 | |||
| 261010f23d | |||
| ede44ca6ee | |||
| 452a953234 | |||
| 2b122562ad | |||
| 6891bc3da3 | |||
| b31b8cd7f0 | |||
| e1379ac5ce | |||
| 0ef3f75d7a | |||
| 407a9e5be0 | |||
| 892bb9bf30 | |||
| 47ac871a12 | |||
| a38c3e7f6d | |||
| 08818355d1 | |||
| 0a68afef00 | |||
| 2c0783e327 | |||
| c2e5e45c84 | |||
| 014236c861 | |||
| 610fd7561b | |||
| d6f4480a4f | |||
| 28a6ac09ad | |||
| 86e4d24476 | |||
| 913a697ab2 | |||
| ebef2b1e44 | |||
| a61457b422 | |||
| 8f7f1135df | |||
| 89612c10c9 | |||
| d55bfb32f1 | |||
| d2b72cf496 | |||
| 8d90fffd46 | |||
| b84af27a86 | |||
| b45f28f3e9 | |||
| bfa1b5656a | |||
| 47f946cd65 | |||
| 970e7bfcda | |||
| a81c7a7cd6 | |||
| b0e1bd239f | |||
| 53ca41717a | |||
| 6a5bee0cdd | |||
| fd3ae51f83 | |||
| 5e5954a808 | |||
| add8540909 | |||
| 06a302aed0 | |||
| 147432d38d | |||
| 2a003ff72b | |||
| 8660d3324d | |||
| 6c59b73ae5 | |||
| 80218c1eca | |||
| f24d96d59f | |||
| d14bd49f46 | |||
| 1a692a0873 | |||
| 631a1a4ddc | |||
| 57df7601d9 | |||
| f7650000aa | |||
| 6f93c2d9b2 | |||
| 1654764968 | |||
| 1a1b8416e2 | |||
| 36c66d52a6 | |||
| 68fe43d488 | |||
| 877b9ee23b | |||
| 80ff93beeb | |||
| b9ddd2812b | |||
| ba54b56de4 | |||
| 85be67bc2d | |||
| ae20e01d2c | |||
| d094e8c3fc | |||
| f009fe1f63 | |||
| 2007fe5f49 | |||
| 84989ffa04 | |||
| 31b629a19c | |||
| e762d9e274 | |||
| 6833267b19 | |||
| 05f2833388 | |||
| 0d026ef18d | |||
| b756d93891 | |||
| f54513586d | |||
| 6c519c237e | |||
| 4ffde4db98 | |||
| 41847d31e7 | |||
| 24ce25bb5c | |||
| e051b69e80 | |||
| 59283d1164 | |||
| 0de32a5edc | |||
| 4f80066dcb | |||
| 04ddc8003f | |||
| 3213f98d66 | |||
| 1f16f85c51 | |||
| c03cb3a11c | |||
| 62e29a6546 | |||
| 3574b065d6 | |||
| c0c47f41be | |||
| 37761d580f | |||
| e075c8e691 | |||
| 0c61ca1a6b | |||
| 1846fa1f54 | |||
| 579ce20cad | |||
| 12e4bcba5d | |||
| b4f57dee3b | |||
| f11673ae3f | |||
| a27af7dd7e | |||
| 2b26a3cc14 | |||
| 47c4849694 | |||
| 30a4adf331 | |||
| 117a721166 | |||
| 1a219e62ba | |||
| c8d54b324b | |||
| 0ac2971fc1 | |||
| 348a40201b | |||
| 9f20ddc800 | |||
| 6f1cc2c1e5 | |||
| 601cd95277 | |||
| 8e9ce59ef2 | |||
| d76ef8e3cf | |||
| c19ffafd8d | |||
| 996a99ad75 | |||
| affb926d44 | |||
| c506e534aa | |||
| 9994315070 | |||
| 4f0d89ef8b | |||
| aab984618d | |||
| 8b662bc6b5 | |||
| 03ce7a8db3 | |||
| 033e7928b5 | |||
| b095f2a158 | |||
| 196c0e0ebc | |||
| 8ab309630b | |||
| 42bac47a71 | |||
| 3bc4de2236 | |||
| a6e4b45a38 | |||
| 28e97ccaf2 | |||
| 255781c029 | |||
| 7f5635ea8c | |||
| 4f18ec726c | |||
| 263622d628 | |||
| 1dfd2443ac | |||
| 881bd53f60 | |||
| ec4404b1ba | |||
| badaeac81f | |||
| 618d5ddaff | |||
| 4ed74af868 | |||
| 123d9af7d0 | |||
| 4f17b30915 | |||
| 1fc265b0aa | |||
| afae9b8d17 | |||
| 481be44879 | |||
| b8530b0f0b | |||
| 69de79684f | |||
| 6e6fd057b5 | |||
| 4b0ebf2b80 | |||
| ee82c32119 | |||
| 3fe6731035 | |||
| 1c3f3b5705 | |||
| def1ccffc4 | |||
| fa2e531343 | |||
| 814ddbc6cc | |||
| 267e8dcfb6 | |||
| 49ec1561f8 | |||
| e2dc612153 | |||
| 8f225431fe | |||
| 194be5e0b7 | |||
| 6788a05dd1 | |||
| 6a7066ac2f | |||
| ec5ff4e973 | |||
| fe6d460531 | |||
| 9cb97af10f | |||
| 1c784eea3d | |||
| 59dd33a461 | |||
| 97ebd912dc | |||
| 742fcc060c | |||
| 3ad5cb8a23 | |||
| 0d1f12e31a | |||
| a8ddf8f66d | |||
| f7a9c0a248 | |||
| 190badb395 | |||
| 3d91ab6c31 | |||
| c15b8d71bc | |||
| 5a707dba8a | |||
| ffd2fcde6b | |||
| 8e4056c1e4 | |||
| 1554e2b135 | |||
| 4715cbb70d | |||
| fd1611079a | |||
| 8edc03df64 | |||
| 9f5c0af5b8 | |||
| 6d6eeba5d5 | |||
| 5dfb64ef71 | |||
| e5bda7add7 | |||
| 77f9b336bd | |||
| cf930d0dde | |||
| f01c94e8bc | |||
| 0d774527b4 | |||
| 58ba9496d0 | |||
| 1993e94e53 | |||
| 3bcc06ed09 | |||
| 2f6ce88e28 | |||
| cd1dec9fc7 | |||
| 05872d7650 | |||
| 1dcee2ffa2 | |||
| 5f622efb77 | |||
| 52e8326d54 | |||
| 436532bed7 | |||
| d15e789200 | |||
| 98942f5528 | |||
| c7c21dc122 | |||
| 4500c1d1a4 | |||
| b8b983dded | |||
| d6a6673971 | |||
| 0580fe8db8 | |||
| c727e24138 | |||
| b83698ebf5 | |||
| 3fbbaa5130 | |||
| 2f48b840ae | |||
| efdee11d5a | |||
| 4c87e11aeb | |||
| e881e008b8 | |||
| 1b2837915d | |||
| d076a6724f | |||
| 386af71c39 | |||
| 49f277192c | |||
| 5974a6276b | |||
| e06a390771 | |||
| b34e204676 | |||
| 755d990dfd | |||
| 7185358b98 | |||
| 3843ec1e02 | |||
| cfc5631d5d | |||
| e64555aca0 | |||
| ef52ebb529 | |||
| c98136ca4f | |||
| 65f44d24ca | |||
| 44f20782fd | |||
| 9b1d76a5d0 | |||
| 21b5074ce8 | |||
| 0b8825fecb | |||
| 3d3c20e507 | |||
| 67a282f19f | |||
| 92023b533a | |||
| c1d14c150e | |||
| aa656c74d5 | |||
| e39b7ffe30 | |||
| 1897148abc | |||
| b76118802a | |||
| 8266aa3343 | |||
| ab0c349261 | |||
| d5e0e66426 | |||
| c5b3107f83 | |||
| 1a0a64e4de | |||
| 6bd9805bcc | |||
| f74c2af65c | |||
| 9531bdf674 | |||
| 76e705e7ee | |||
| d35211328e | |||
| b7bbd81dda | |||
| 9836dd5d10 | |||
| 2109ad320d | |||
| c026121c0e | |||
| ee0c87f7b1 | |||
| 709fb93a22 | |||
| b38cd0a48d | |||
| 264435c32d | |||
| c285929ad3 | |||
| 1cbea8157d | |||
| 0a10334f1b | |||
| f0d5a6ebac | |||
| db7086b5e6 | |||
| 0e92280b33 | |||
| 0d7255158a | |||
| 33564b68dd | |||
| ba942b952a | |||
| bd7f28896e | |||
| 18fe124696 | |||
| ea3a3b6e1c | |||
| e6c06aacff | |||
| 1aee92cd5c | |||
| 40c4cad491 | |||
| 013d46fb02 | |||
| f0f465411f | |||
| 32ce83475d | |||
| ec0d3f5b5d | |||
| 75294b9146 | |||
| 26a0eb68ef | |||
| b983e29fb0 | |||
| 68dadabc29 | |||
| ed9fd3f0e0 | |||
| fa9573436a | |||
| 6d2058c3b7 | |||
| 0d7f93b877 | |||
| f022c9d510 | |||
| 5964a06386 | |||
| f14dc4a4e9 | |||
| fd56e2534c | |||
| 08962a74ab | |||
| f850d36c52 | |||
| c5fb161477 | |||
| bfc2fab33f | |||
| ec9d6c4fd2 | |||
| 6135d61e3d | |||
| a677242a2c | |||
| 6602f30112 | |||
| a4b8dc18c1 | |||
| c0d4741f88 | |||
| b33718180c | |||
| 3872393b29 | |||
| 1d72a7df99 | |||
| 5455908772 | |||
| 8882192fac | |||
| 7b77491c06 | |||
| 20bf214d6e | |||
| 8ab3e63aeb | |||
| 0dc03214c5 | |||
| 362e98b43d | |||
| 193e085cf0 | |||
| e0df2a342b | |||
| ba19ccac43 | |||
| d7261b7a78 | |||
| 0d80173efd | |||
| 930f07d15e | |||
| 66df7389d2 | |||
| c7bf0b6ddd | |||
| 0bc361adeb | |||
| 4fff523a6d | |||
| 67e09fb342 | |||
| c360806f47 | |||
| 7b74b73b08 | |||
| e9a851c0d4 | |||
| b13b169149 | |||
| 455329a745 | |||
| a68b76c8b4 | |||
| 96e3899216 | |||
| 771ab5ea9a | |||
| 3c87e6b270 | |||
| 6d8afec510 | |||
| 89e25657d8 | |||
| 29387f1fcf | |||
| 58e885c052 | |||
| 984dfcd7e1 | |||
| 3785479086 | |||
| 8ed280907c | |||
| d742671205 | |||
| 87e72c28a4 | |||
| 4dee357362 | |||
| 431f4b9b0d | |||
| dd5b7825d5 | |||
| 02bc48925a | |||
| 4eb505755e | |||
| 83e94a70ea | |||
| 8a150b27c3 | |||
| 1a51451ec2 | |||
| 41e51bfb77 | |||
| 7e1d9bc768 | |||
| ba065ec1d8 | |||
| fe057a91c8 | |||
| d2c36eefc9 | |||
| 28d56bab04 | |||
| 2500eff90d | |||
| 153446b3a1 | |||
| 391f5caaa2 | |||
| cc0df92444 | |||
| 03910d67c3 | |||
| fec5cc864e | |||
| cb78362713 | |||
| 4c5b1a6ff4 | |||
| 83c5727698 | |||
| 80838ff1e9 | |||
| 29e8d072b7 | |||
| d7592f01e1 | |||
| 392f283d9e | |||
| bcd738ebbb | |||
| 8020c52c48 | |||
| 3f566e541d | |||
| be4a631dc8 | |||
| 0bfdf908c1 | |||
| 6f2fc23f77 | |||
| f3a47c7e70 | |||
| 36349ffabb | |||
| b13f7366cf | |||
| 9181bcd9a7 | |||
| 7dbc1d894b | |||
| 5720445d15 | |||
| a90027521d | |||
| e02d400bf6 | |||
| efadb8fd31 | |||
| a19d06561b | |||
| 0b685d11c9 | |||
| 28f019d672 | |||
| bf5cbfffc2 | |||
| fe021e7c51 | |||
| c42fb54bc6 | |||
| 9382b68781 | |||
| 178198a417 | |||
| 7068e90771 | |||
| 1c762f23d0 | |||
| fd2b9a6e21 | |||
| db43910288 | |||
| f248c0460e | |||
| b8e3c0ceb4 | |||
| b5053d889e | |||
| 12ba7776b3 | |||
| 7817e88d03 | |||
| 8dec65853d | |||
| 88e3cb3be1 | |||
| fa702b48e3 | |||
| 299dcf6686 | |||
| 27f9ae5bbb | |||
| 9cb3a853f1 | |||
| 95c8ef4148 | |||
| a41bb52014 | |||
| 914cd7221e | |||
| 2dfc0a58ab | |||
| 0c9f3c638a | |||
| a966d6acf1 | |||
| 1e0c38b5f9 | |||
| d3323d6550 | |||
| ebed0b9f20 | |||
| f654a453dc | |||
| 10decf94cc | |||
| 96dd4817f1 | |||
| 72906cdc6a | |||
| fba4375be0 | |||
| 75120676ad | |||
| 7daf63fd3f | |||
| 014de25f6f | |||
| 3fc6535012 | |||
| 4fc0a32572 | |||
| dcc704a357 | |||
| bd8acbde97 | |||
| 112b10c19d | |||
| d89e561a85 | |||
| 49c1da79c8 | |||
| 0a72f00175 | |||
| 1af5820db0 | |||
| c117491549 | |||
| d8748f4270 | |||
| c0ba6e13e4 | |||
| c34daf1a35 | |||
| d461b53235 | |||
| c3ee14eb67 | |||
| 869fb8e327 | |||
| fbbc3024d6 | |||
| f1ba0c0aa7 | |||
| 54340ab4bf | |||
| 39732eee5e | |||
| a9e4526a6d | |||
| 57a6d2abf9 | |||
| d6246941ac | |||
| 2eb91f9b91 | |||
| 34ae413607 | |||
| ee9f8c184b | |||
| 7a84afcbdb | |||
| b8a16ea99d | |||
| 095466d5c7 | |||
| 89cfa22c3f | |||
| 1f18050930 | |||
| 537b78d564 | |||
| 717fd57ce1 | |||
| 3fb7786868 | |||
| 17ecfc9765 | |||
| 5326260a76 | |||
| e7522f4bdf | |||
| 504deeff42 | |||
| b7785b64cf | |||
| f914cb6858 | |||
| 91051d2521 | |||
| 51536a7acd | |||
| 263ccab6e3 | |||
| 9f87755dcb | |||
| 60b4cca5e5 | |||
| d2718e99a4 | |||
| 69a00c0ab3 | |||
| 3272d23917 | |||
| 7f0545cae7 | |||
| 68f35deb86 | |||
| c4f4035072 | |||
| a7d8845952 | |||
| a3378393b0 | |||
| 3dfe0ad478 | |||
| 9a3b7a4f3f | |||
| 78579b1103 | |||
| 7d50344512 | |||
| 7a00c12065 | |||
| af71e67681 | |||
| b3e20fc324 | |||
| bd1014abb6 | |||
| 7f76664a5d | |||
| 0a5a80b05d | |||
| 2d63da0660 | |||
| 8387527d2e | |||
| 5d03ba7d63 | |||
| 0ece50c122 | |||
| f2ac297252 | |||
| 0ca8ae17d4 | |||
| 88ca87cf9e | |||
| 0d69d228e4 | |||
| a3afe95306 | |||
| 9fb4af8658 | |||
| 9bb6ba9311 | |||
| faa42ba341 | |||
| 596827a912 | |||
| 89b4292445 | |||
| dd88737414 | |||
| 5456cfc304 | |||
| 1e66096ea7 | |||
| 2b6ae3908c | |||
| 1924612479 | |||
| 2af5bdeaab | |||
| b28565b38d | |||
| fec602362b | |||
| 6753c5f45a | |||
| 2f3c108d42 |
@@ -0,0 +1,28 @@
|
|||||||
|
# "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." --Rob Pike
|
||||||
|
#
|
||||||
|
# for clang-format-10.0.1 from https://github.com/upx/upx-stubtools/releases
|
||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
#AlignConsecutiveAssignments: true
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
ColumnLimit: 100
|
||||||
|
IndentWidth: 4
|
||||||
|
SortIncludes: false
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
Standard: Cpp03
|
||||||
|
StatementMacros: [
|
||||||
|
ACCCHK_ASSERT,
|
||||||
|
ACCCHK_ASSERT_IS_SIGNED_T,
|
||||||
|
ACCCHK_ASSERT_IS_UNSIGNED_T,
|
||||||
|
ACCCHK_ASSERT_SIGN_T,
|
||||||
|
ACC_COMPILE_TIME_ASSERT,
|
||||||
|
ACC_COMPILE_TIME_ASSERT_HEADER,
|
||||||
|
ACC_CXX_DISABLE_NEW_DELETE,
|
||||||
|
ACC_CXX_TRIGGER_FUNCTION,
|
||||||
|
ACC_CXX_TRIGGER_FUNCTION_IMPL,
|
||||||
|
CLANG_FORMAT_DUMMY_STATEMENT,
|
||||||
|
COMPILE_TIME_ASSERT,
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1,
|
||||||
|
]
|
||||||
|
...
|
||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
.bzr*
|
|
||||||
.darcs*
|
|
||||||
.git*
|
|
||||||
.hg*
|
|
||||||
_darcs
|
|
||||||
B
|
|
||||||
build*
|
|
||||||
doxygen
|
|
||||||
maint
|
|
||||||
ChangeLog.cvs*
|
|
||||||
GNUmakefile
|
|
||||||
MMakefile
|
|
||||||
TODO.*
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# see https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[{GNUmakefile*,MMakefile*,Makefile*,Makevars*,*.mk}]
|
||||||
|
indent_size = 8
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
|
[*.S]
|
||||||
|
indent_size = 8
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_size = 2
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
# make GitHub language detection more accurate, see https://github.com/github/linguist
|
||||||
|
|
||||||
|
src/*.h linguist-language=C++
|
||||||
|
src/*/*.h linguist-language=C++
|
||||||
|
|
||||||
|
src/stub/**/*.ash linguist-language=Assembly
|
||||||
|
src/stub/**/*.asm linguist-language=Assembly
|
||||||
|
src/stub/**/*.S linguist-language=Assembly
|
||||||
|
|
||||||
|
src/stub/tmp/** linguist-vendored
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
This issue tracker is **ONLY** used for reporting bugs.
|
||||||
|
Please use [stackoverflow](https://stackoverflow.com) for supporting issues.
|
||||||
|
|
||||||
|
<!---
|
||||||
|
|
||||||
|
IF YOU REMOVE THIS TEMPLATE WE WILL CLOSE YOUR ISSUE WITHOUT RESPONSE.
|
||||||
|
Just read it and fill in the details we're asking, it saves so much of our time. Thanks!
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## What's the problem (or question)?
|
||||||
|
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||||
|
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||||
|
|
||||||
|
## What should have happened?
|
||||||
|
<!--- If you're describing a bug, tell us what should happen -->
|
||||||
|
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||||
|
|
||||||
|
## Do you have an idea for a solution?
|
||||||
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
|
<!--- or ideas how to implement the addition or change -->
|
||||||
|
|
||||||
|
## How can we reproduce the issue?
|
||||||
|
<!--- Provide unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant -->
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
|
||||||
|
## Please tell us details about your environment.
|
||||||
|
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||||
|
* UPX version used (`upx --version`):
|
||||||
|
* Host Operating System and version:
|
||||||
|
* Host CPU architecture:
|
||||||
|
* Target Operating System and version:
|
||||||
|
* Target CPU architecture:
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
This issue tracker is **ONLY** used for requesting sensible features.
|
||||||
|
Please use [stackoverflow](https://stackoverflow.com) for supporting issues.
|
||||||
|
|
||||||
|
<!---
|
||||||
|
|
||||||
|
IF YOU REMOVE THIS TEMPLATE WE WILL CLOSE YOUR ISSUE WITHOUT RESPONSE.
|
||||||
|
Just read it and fill in the details we're asking, it saves so much of our time. Thanks!
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
## What's the problem (or question)?
|
||||||
|
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||||
|
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||||
|
|
||||||
|
## What should have happened?
|
||||||
|
<!--- If you're describing a bug, tell us what should happen -->
|
||||||
|
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||||
|
|
||||||
|
## Do you have an idea for a solution?
|
||||||
|
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||||
|
<!--- or ideas how to implement the addition or change -->
|
||||||
|
|
||||||
|
## How can we reproduce the issue?
|
||||||
|
<!--- Provide unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant -->
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
4.
|
||||||
|
|
||||||
|
## Please tell us details about your environment.
|
||||||
|
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||||
|
* UPX version used (`upx --version`):
|
||||||
|
* Host Operating System and version:
|
||||||
|
* Host CPU architecture:
|
||||||
|
* Target Operating System and version:
|
||||||
|
* Target CPU architecture:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
version: 2
|
||||||
|
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: 'github-actions'
|
||||||
|
directory: '/'
|
||||||
|
schedule:
|
||||||
|
# Check for updates to GitHub Actions every weekday
|
||||||
|
interval: 'daily'
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
UPX PULL REQUEST NOTES
|
||||||
|
======================
|
||||||
|
|
||||||
|
Handling pull requests is actually quite time consuming, so please
|
||||||
|
|
||||||
|
- if you want to contribute **a real C++ code bug-fix** then open an issue
|
||||||
|
on the main UPX issue tracker first
|
||||||
|
|
||||||
|
- if you want to contribute **a new feature** then by all means open an issue
|
||||||
|
on the main UPX issue tracker first before starting any coding!
|
||||||
|
|
||||||
|
- please refuse the temptation to "improve" the docs, scripts, CI, makefiles,
|
||||||
|
cmake build system, spelling errors, etc - we will NOT merge this; only open
|
||||||
|
an issue if you're sure there is a **real bug**
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Security Context
|
||||||
|
|
||||||
|
IMPORTANT NOTE: UPX inherits the security context of any files it handles.
|
||||||
|
|
||||||
|
This means that packing, unpacking, or even testing or listing a file requires
|
||||||
|
the same security considerations as actually executing the file.
|
||||||
|
|
||||||
|
Use UPX on trusted files only!
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| --------- | ------------------ |
|
||||||
|
| git HEAD | :white_check_mark: |
|
||||||
|
| any other | :x: |
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
# ...lots of outdated/unneeded stuff from the old Travis/Circle/AppVeyor CI days...
|
||||||
|
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
else
|
||||||
|
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
fi
|
||||||
|
source "$argv0dir/travis_init.sh" || exit 1
|
||||||
|
|
||||||
|
# create dirs
|
||||||
|
cd / || exit 1
|
||||||
|
mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR
|
||||||
|
cd / && cd "$upx_SRCDIR" || exit 1
|
||||||
|
|
||||||
|
echo
|
||||||
|
print_settings
|
||||||
|
echo
|
||||||
|
echo "$CC --version"; $CC --version
|
||||||
|
echo "$CXX --version"; $CXX --version
|
||||||
|
echo
|
||||||
|
|
||||||
|
# check whitespace
|
||||||
|
if [[ $TRAVIS_OS_NAME == linux ]]; then
|
||||||
|
cd / && cd $upx_SRCDIR || exit 1
|
||||||
|
echo "Checking source code for whitespace violations..."
|
||||||
|
bash ./misc/scripts/check_whitespace.sh || exit 1
|
||||||
|
echo " Passed."
|
||||||
|
fi # linux
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
#
|
||||||
|
# rebuild UPX stubs (needs upx-stubtools)
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $BM_X =~ (^|\+)rebuild-stubs($|\+) ]]; then
|
||||||
|
if [[ -f "$HOME/local/bin/bin-upx/upx-stubtools-check-version" ]]; then
|
||||||
|
bin_upx=$(readlink -en -- "$HOME/local/bin/bin-upx")
|
||||||
|
elif [[ -f "$HOME/.local/bin/bin-upx/upx-stubtools-check-version" ]]; then
|
||||||
|
bin_upx=$(readlink -en -- "$HOME/.local/bin/bin-upx")
|
||||||
|
else
|
||||||
|
bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20210104")
|
||||||
|
fi
|
||||||
|
cd / && cd "$upx_SRCDIR" || exit 1
|
||||||
|
extra_subdirs=()
|
||||||
|
extra_subdirs+=( src/stub/src/arch/amd64 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/arm/v4a )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/arm/v4t )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/arm64/v8 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/i386 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/m68k/m68000 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/m68k/m68020 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/mips/r3000 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/powerpc/32 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/powerpc/64 )
|
||||||
|
extra_subdirs+=( src/stub/src/arch/powerpc/64le )
|
||||||
|
make -C src/stub maintainer-clean
|
||||||
|
for d in ${extra_subdirs[@]}; do
|
||||||
|
make -C $d -f Makefile.extra maintainer-clean
|
||||||
|
git status $d || true
|
||||||
|
done
|
||||||
|
git status src/stub/src || true
|
||||||
|
git status || true
|
||||||
|
failed=0
|
||||||
|
for d in ${extra_subdirs[@]}; do
|
||||||
|
PATH="$bin_upx:$PATH" make -C $d -f Makefile.extra || failed=1
|
||||||
|
done
|
||||||
|
PATH="$bin_upx:$PATH" make -C src/stub all || failed=1
|
||||||
|
if [[ $failed != 0 ]]; then
|
||||||
|
echo "UPX-ERROR: FATAL: rebuild-stubs failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! git diff --quiet; then
|
||||||
|
git status || true
|
||||||
|
git diff || true
|
||||||
|
echo "UPX-ERROR: FATAL: rebuild-stubs git status mismatch. See log file."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
git status
|
||||||
|
if [[ $BM_X == rebuild-stubs ]]; then
|
||||||
|
echo "X=rebuild-stubs done. Exiting."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
unset bin_upx extra_subdirs d failed
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
||||||
@@ -0,0 +1,273 @@
|
|||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
# ...lots of outdated/unneeded stuff from the old Travis/Circle/AppVeyor CI days...
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
umask 022
|
||||||
|
export GIT_PAGER=
|
||||||
|
|
||||||
|
# rename short variables to more readable Build-Matrix BM_ names
|
||||||
|
# C is COMPILER
|
||||||
|
# B is BUILD_OPTIONS
|
||||||
|
# T is TESTSUITE_OPTIONS
|
||||||
|
# X is EXTRA_OPTIONS
|
||||||
|
BM_CROSS=$CROSS; BM_C=$C; BM_B=$B; BM_T=$T; BM_X=$X
|
||||||
|
unset CROSS C B T X
|
||||||
|
[[ -z $BM_C ]] && BM_C=gcc
|
||||||
|
[[ -z $BM_B ]] && BM_B=release
|
||||||
|
|
||||||
|
# just in case, unset variable for passing extra UPX options
|
||||||
|
export UPX=
|
||||||
|
# un-export some vars
|
||||||
|
declare +x UPX_AUTOMATIC_BUILDS_SSL_KEY UPX_AUTOMATIC_BUILDS_SSL_IV
|
||||||
|
|
||||||
|
# compatibility wrappers
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
# use GNU coreutils ("brew install coreutils")
|
||||||
|
chmod() {
|
||||||
|
gchmod "$@"
|
||||||
|
}
|
||||||
|
date() {
|
||||||
|
gdate "$@"
|
||||||
|
}
|
||||||
|
readlink() {
|
||||||
|
greadlink "$@"
|
||||||
|
}
|
||||||
|
sha256sum() {
|
||||||
|
gsha256sum "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
openssl() {
|
||||||
|
/usr/bin/openssl "$@"
|
||||||
|
}
|
||||||
|
sort() {
|
||||||
|
/usr/bin/sort "$@"
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set CC and CXX from BM_C and BM_CROSS
|
||||||
|
if [[ -z $CC_OVERRIDE ]]; then
|
||||||
|
CC=false CXX=false SCAN_BUILD=false
|
||||||
|
AR=ar SIZE=size
|
||||||
|
if [[ -n $APPVEYOR_JOB_ID ]]; then
|
||||||
|
BUILD_LOCAL_UCL=1
|
||||||
|
BUILD_LOCAL_ZLIB=1
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
|
||||||
|
fi
|
||||||
|
upx_exeext=.exe
|
||||||
|
# dir c:\cygwin
|
||||||
|
case $BM_C in
|
||||||
|
gcc-m32 | gcc-4.9-m32)
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
gcc-m64 | gcc-4.9-m64)
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
msvc | msvc-*)
|
||||||
|
AR="link -lib"; CC="cl"; CXX="cl" ;; # standard system compiler
|
||||||
|
esac
|
||||||
|
fi # APPVEYOR_JOB_ID
|
||||||
|
if [[ -n $BM_CROSS ]]; then
|
||||||
|
BUILD_LOCAL_UCL=1
|
||||||
|
BUILD_LOCAL_ZLIB=1
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
|
||||||
|
fi
|
||||||
|
cat /etc/os-release || true
|
||||||
|
if grep -E -q '^PRETTY_NAME="?Ubuntu .*12\.04' /etc/os-release; then
|
||||||
|
case $BM_CROSS-$BM_C in
|
||||||
|
arm-linux-gnueabi-gcc | arm-linux-gnueabi-gcc-4.6)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
|
||||||
|
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
|
||||||
|
arm-linux-gnueabihf-gcc | arm-linux-gnueabihf-gcc-4.6)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
|
||||||
|
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
|
||||||
|
i[36]86-w64-mingw32-gcc | i[36]86-w64-mingw32-gcc-4.6)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
x86_64-w64-mingw32-gcc | x86_64-w64-mingw32-gcc-4.6)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
esac
|
||||||
|
elif grep -E -q '^PRETTY_NAME="?Ubuntu 16\.04' /etc/os-release; then
|
||||||
|
case $BM_CROSS-$BM_C in
|
||||||
|
aarch64-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-aarch64 -L /usr/aarch64-linux-gnu"
|
||||||
|
x=aarch64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
arm-linux-gnueabi-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
|
||||||
|
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
arm-linux-gnueabihf-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
|
||||||
|
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
i[36]86-w64-mingw32-gcc-5)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
|
||||||
|
mips-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-mips -L /usr/mips-linux-gnu"
|
||||||
|
x=mips-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
mipsel-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-mipsel -L /usr/mipsel-linux-gnu"
|
||||||
|
x=mipsel-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc -L /usr/powerpc-linux-gnu"
|
||||||
|
x=powerpc-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc64-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64 -L /usr/powerpc64-linux-gnu"
|
||||||
|
x=powerpc64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
powerpc64le-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64le -L /usr/powerpc64le-linux-gnu"
|
||||||
|
x=powerpc64le-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
s390x-linux-gnu-gcc-5)
|
||||||
|
[[ -z $upx_qemu ]] && upx_qemu="qemu-s390x -L /usr/s390x-linux-gnu"
|
||||||
|
x=s390x-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
|
||||||
|
x86_64-w64-mingw32-gcc-5)
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine"
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
esac
|
||||||
|
elif grep -E -q '^PRETTY_NAME="?Ubuntu 20\.04' /etc/os-release; then
|
||||||
|
case $BM_CROSS-$BM_C in
|
||||||
|
x86_64-w64-mingw32-gcc-9)
|
||||||
|
export upx_EXTRA_CPPFLAGS="-D__USE_MINGW_ANSI_STDIO=1"
|
||||||
|
export upx_EXTRA_LDFLAGS="-static"
|
||||||
|
upx_exeext=.exe
|
||||||
|
[[ -z $upx_wine ]] && upx_wine="wine64"
|
||||||
|
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi # BM_CROSS
|
||||||
|
if [[ $CC == "false" ]]; then # generic
|
||||||
|
if [[ -z $BM_CROSS ]]; then
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
case $BM_C in
|
||||||
|
clang | clang-m?? | clang-[6789][0-9][0-9]-m?? | clang-1[0-1][0-9][0-9]-m??)
|
||||||
|
CC="clang"; CXX="clang++" ;; # standard system compiler
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
case $BM_C in
|
||||||
|
clang | clang-m?? | clang-3.4-m??)
|
||||||
|
CC="clang"; CXX="clang++" ;; # standard system compiler
|
||||||
|
clang-[3456].[0-9]-m??)
|
||||||
|
v=${BM_C:6:3}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
|
||||||
|
clang-[789]-m??)
|
||||||
|
v=${BM_C:6:1}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
|
||||||
|
clang-1[0-9]-m??)
|
||||||
|
v=${BM_C:6:2}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
|
||||||
|
gcc | gcc-m?? | gcc-mx32)
|
||||||
|
CC="gcc"; CXX="g++" ;; # standard system compiler
|
||||||
|
gcc-[34].[0-9]-m?? | gcc-[34].[0-9]-mx32)
|
||||||
|
v=${BM_C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;;
|
||||||
|
gcc-[56789]-m?? | gcc-[56789]-mx32)
|
||||||
|
v=${BM_C:4:1}; CC="gcc-$v"; CXX="g++-$v" ;;
|
||||||
|
gcc-1[0-9]-m?? | gcc-1[0-9]-mx32)
|
||||||
|
v=${BM_C:4:2}; CC="gcc-$v"; CXX="g++-$v" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi # generic
|
||||||
|
case $BM_C in
|
||||||
|
clang*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
|
||||||
|
clang*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
|
||||||
|
gcc*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
|
||||||
|
gcc*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
|
||||||
|
gcc*-mx32) CC="$CC -mx32"; CXX="$CXX -mx32"; BUILD_LOCAL_UCL=1; BUILD_LOCAL_ZLIB=1 ;;
|
||||||
|
esac
|
||||||
|
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
|
||||||
|
CC="$CC -std=gnu89"
|
||||||
|
fi
|
||||||
|
unset v x
|
||||||
|
export AR CC CXX
|
||||||
|
fi # CC_OVERRIDE
|
||||||
|
|
||||||
|
# source dirs
|
||||||
|
[[ -z $upx_SRCDIR ]] && upx_SRCDIR=$(readlink -mn -- $argv0dir/..)
|
||||||
|
[[ -z $ucl_SRCDIR ]] && ucl_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/ucl-1.03)
|
||||||
|
[[ -z $upx_testsuite_SRCDIR ]] && upx_testsuite_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/upx-testsuite)
|
||||||
|
[[ -z $zlib_SRCDIR ]] && zlib_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/zlib-1.2.11)
|
||||||
|
|
||||||
|
# build dirs
|
||||||
|
mkbuilddirs() {
|
||||||
|
local d
|
||||||
|
for d in "$@"; do
|
||||||
|
mkdir -p -v "$d" || exit 1
|
||||||
|
[[ -f "$d/.mfxnobackup" ]] || touch "$d/.mfxnobackup"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
# search for an existing $toptop_builddir
|
||||||
|
if [[ -z $toptop_builddir ]]; then
|
||||||
|
for d in . ..; do
|
||||||
|
for subdir in "local" appveyor circle github gitlab travis .; do
|
||||||
|
dd=$d/build/$subdir
|
||||||
|
if [[ -d $dd ]]; then
|
||||||
|
toptop_builddir=$(readlink -en -- "$dd")
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
unset d subdir dd
|
||||||
|
fi
|
||||||
|
[[ -z $toptop_builddir ]] && toptop_builddir=$(readlink -mn -- ./build)
|
||||||
|
[[ -z $toptop_bdir ]] && toptop_bdir=$(readlink -mn -- "$toptop_builddir/${BM_CROSS:+$BM_CROSS-}$BM_C/$BM_B")
|
||||||
|
[[ -z $upx_BUILDDIR ]] && upx_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx")
|
||||||
|
[[ -z $ucl_BUILDDIR ]] && ucl_BUILDDIR=$(readlink -mn -- "$toptop_bdir/ucl-1.03")
|
||||||
|
[[ -z $upx_testsuite_BUILDDIR ]] && upx_testsuite_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx-testsuite")
|
||||||
|
[[ -z $zlib_BUILDDIR ]] && zlib_BUILDDIR=$(readlink -mn -- "$toptop_bdir/zlib-1.2.11")
|
||||||
|
[[ -z $lcov_OUTPUTDIR ]] && lcov_OUTPUTDIR=$(readlink -mn -- "$toptop_bdir/.lcov-results")
|
||||||
|
unset toptop_builddir toptop_bdir
|
||||||
|
|
||||||
|
# ensure absolute directories
|
||||||
|
make_absolute() {
|
||||||
|
local d
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
if [[ -n ${!1} ]]; then
|
||||||
|
d=$(readlink -mn -- "${!1}")
|
||||||
|
eval $1="$d"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
for var_prefix in ucl upx upx_testsuite zlib; do
|
||||||
|
for var_suffix in _BUILDDIR _SRCDIR; do
|
||||||
|
make_absolute ${var_prefix}${var_suffix}
|
||||||
|
done
|
||||||
|
done
|
||||||
|
make_absolute lcov_OUTPUTDIR
|
||||||
|
unset var_prefix var_suffix
|
||||||
|
|
||||||
|
print_header() {
|
||||||
|
local x="==========="; x="$x$x$x$x$x$x$x"
|
||||||
|
echo -e "\n${x}\n${1}\n${x}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_settings() {
|
||||||
|
local v var_prefix var_suffix
|
||||||
|
# Build Matrix
|
||||||
|
for v in TRAVIS_OS_NAME BM_CROSS BM_C BM_B BM_T; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
# BM_C related
|
||||||
|
for v in AR CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LIBS SCAN_BUILD; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
v=EXTRA_${v}
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
# directories and other info
|
||||||
|
for v in TRAVIS_XCODE_SDK UPX_UCLDIR lcov_OUTPUTDIR; do
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
for var_prefix in ucl upx upx_testsuite zlib; do
|
||||||
|
for var_suffix in _BUILDDIR _SRCDIR; do
|
||||||
|
v=${var_prefix}${var_suffix}
|
||||||
|
[[ -n ${!v} ]] && echo "${v}='${!v}'"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
##env | LC_ALL=C sort
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
########## begin .sha256sums.recreate
|
||||||
|
expected_sha256sums__t010_decompressed="\
|
||||||
|
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
|
||||||
|
24808d572483f4cd713d66894b3da406755038737007a78b076528e6407e3132 *amd64-linux.elf/upx-3.95
|
||||||
|
d88eaad0528bcecec9f51cbe015a117c8cf350a3f6d8308f2b0517d4fd19d189 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
f7279729eb975e4238f8b8ee56fefa41ccbeb35ef0ffe4c34f8047baab78fff5 *arm-linux.elf/upx-3.95
|
||||||
|
e09df2a69f88c692138447f274ba7f99cdd11f8696c71ac8d3761606c95ab5c5 *arm-wince.pe/upx-3.91.exe
|
||||||
|
ce81113f8a4ff1cd806811cb80ab8bea5c9c6fbced47451c7f07e50700f9817b *arm64-linux.elf/upx-3.95
|
||||||
|
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
|
||||||
|
84b90eb0d617571fe4885639925b35ca6a61060cb2616bb5bf729b4d701653e4 *armeb-linux.elf/upx-3.95
|
||||||
|
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
7d331e508449497f64cd47abdd3f00f70307f508ad3fd692d333feb97beccead *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
|
||||||
|
a1f3e5ffa7b2cfebe1e475ac1f4c7683b1b8b4e292aa0d04386cc0314dd162c9 *i386-linux.elf/upx-3.95
|
||||||
|
e90fb09a808334c2674996760d42c82f8352e3f671f6b66c11481e772785c4d2 *i386-win32.pe/upx-3.91.exe
|
||||||
|
07bd50c1d80f6ff651228e6fc0ba3a583a472915772244f232696b34156a9d27 *i386-win32.pe/upx-3.95.exe
|
||||||
|
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
8902f38ec3d95d8e077e3ab5fdbb5bad408859913a35deb87041f4f053cd6605 *mips-linux.elf/upx-3.95
|
||||||
|
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
|
||||||
|
dd1496bc4e9c32a5d5dd47e3eaabf7b134ca001d48807eebfd3d5e28c8a2ab58 *mipsel-linux.elf/upx-3.95
|
||||||
|
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
|
||||||
|
2bc00a51daa0bada19a8fa1bd2c227a8596844fa1b0aa3611087f195072700e2 *powerpc-linux.elf/upx-3.95
|
||||||
|
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t020_canonicalized="\
|
||||||
|
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
|
||||||
|
24808d572483f4cd713d66894b3da406755038737007a78b076528e6407e3132 *amd64-linux.elf/upx-3.95
|
||||||
|
d88eaad0528bcecec9f51cbe015a117c8cf350a3f6d8308f2b0517d4fd19d189 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
f7279729eb975e4238f8b8ee56fefa41ccbeb35ef0ffe4c34f8047baab78fff5 *arm-linux.elf/upx-3.95
|
||||||
|
e09df2a69f88c692138447f274ba7f99cdd11f8696c71ac8d3761606c95ab5c5 *arm-wince.pe/upx-3.91.exe
|
||||||
|
ce81113f8a4ff1cd806811cb80ab8bea5c9c6fbced47451c7f07e50700f9817b *arm64-linux.elf/upx-3.95
|
||||||
|
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
|
||||||
|
84b90eb0d617571fe4885639925b35ca6a61060cb2616bb5bf729b4d701653e4 *armeb-linux.elf/upx-3.95
|
||||||
|
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
7d331e508449497f64cd47abdd3f00f70307f508ad3fd692d333feb97beccead *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
|
||||||
|
a1f3e5ffa7b2cfebe1e475ac1f4c7683b1b8b4e292aa0d04386cc0314dd162c9 *i386-linux.elf/upx-3.95
|
||||||
|
e90fb09a808334c2674996760d42c82f8352e3f671f6b66c11481e772785c4d2 *i386-win32.pe/upx-3.91.exe
|
||||||
|
07bd50c1d80f6ff651228e6fc0ba3a583a472915772244f232696b34156a9d27 *i386-win32.pe/upx-3.95.exe
|
||||||
|
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
8902f38ec3d95d8e077e3ab5fdbb5bad408859913a35deb87041f4f053cd6605 *mips-linux.elf/upx-3.95
|
||||||
|
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
|
||||||
|
dd1496bc4e9c32a5d5dd47e3eaabf7b134ca001d48807eebfd3d5e28c8a2ab58 *mipsel-linux.elf/upx-3.95
|
||||||
|
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
|
||||||
|
2bc00a51daa0bada19a8fa1bd2c227a8596844fa1b0aa3611087f195072700e2 *powerpc-linux.elf/upx-3.95
|
||||||
|
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
|
||||||
|
d8e9cb72d6d63b64b68c44a380b0f700a2c2a127bb128cf16bf003e5fe7b112f *amd64-linux.elf/upx-3.91
|
||||||
|
71c2a5e4b1fd131c7d94c646394228e577e33a90620e6f04ed8ce71bf9419dd6 *amd64-linux.elf/upx-3.95
|
||||||
|
7ef188bb0071bf5ad92edc0ff2cca7798ab2f084bad5d244162bafdd4dd99a03 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
cb458bf41edcac0b50648c15ac538048fd9e57da03c3588f0fa3e524d7e9b856 *arm-linux.elf/upx-3.95
|
||||||
|
5d86c92a039dbe374ff69d1ee160eee849ed7a43aabe21a427482d4f050b98be *arm-wince.pe/upx-3.91.exe
|
||||||
|
9436568081d9bb519cf0c7ad1f9497026e2e74fd29009d4829a05a742c649142 *arm64-linux.elf/upx-3.95
|
||||||
|
e68f0929566ff9a8c978c9203c07bde9bc9ecc57fb3b3664f7ce4cd84ca82d26 *armeb-linux.elf/upx-3.91
|
||||||
|
8fe7b9bcf5db78b3f5585555526ee9aa640e40e97052226431c2f4e2dcd8d26a *armeb-linux.elf/upx-3.95
|
||||||
|
899a2af496235848b333d49645c9b08638170fc05899b55673900e5962d70a2a *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
41048de2b63e0703a78c222efeca6b99225fad8e0c8758775f5fb6e63edde3e9 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
4e7bb9e52a5f8085e9882eff1007b7f401a7fbdfc82e5342ef604e4feb4ccf15 *i386-linux.elf/upx-3.91
|
||||||
|
72fba7c493de49b2ee152629e9083b83d6e732c99eefc7d59641d091c64f171e *i386-linux.elf/upx-3.95
|
||||||
|
38fbad083a8eaa4ed7cb379f21a5277a703baaa77d4e6d9e145d2bb4838513b5 *i386-win32.pe/upx-3.91.exe
|
||||||
|
a27abdb7d9888b7d1e79aa90cdb6a1500e0a3abdc64ee9fbe7db7ce4423ffc79 *i386-win32.pe/upx-3.95.exe
|
||||||
|
a8e11176946ec68f4c2e40e0a585eb70f589560117bef2a98315c454b2fe1f13 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
a80d40f6ae66effe0ce9dfcbcc306e59c61118a3653eba304b6120c3cb4bd951 *mips-linux.elf/upx-3.95
|
||||||
|
8aab2896c689c9b9eae5d205e8dbf3e9896989f212181f666dece91e893314e9 *mipsel-linux.elf/upx-3.91
|
||||||
|
00dbb8a83349fff83374b5a716ae953943b003991e1808e5d773f3e2aa3176bb *mipsel-linux.elf/upx-3.95
|
||||||
|
174a1e090a254cefff98bc23235a3feea9e23c3be0a4c007c44c89a999e62567 *powerpc-linux.elf/upx-3.91
|
||||||
|
f133e103c0d02927311593f6f25ea0c4803fe648919e154a5b2a527964b6a9fb *powerpc-linux.elf/upx-3.95
|
||||||
|
996c63e6717ced59c7dfd4573482ef54d2715dc04bc106e6a86e0317443cb960 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
|
||||||
|
e5fce664c1ed5e4d5ced5186c5b88be8ef14b378b911e2e70bc8e7a331f8e3ff *amd64-linux.elf/upx-3.91
|
||||||
|
86437aa77c0c1c5f55ef8d15ae2ba69d9d48034330faccc025f03a2a7d54ef12 *amd64-linux.elf/upx-3.95
|
||||||
|
761629a404ac155b3f856ff6bedf66266e1c75dcf389b56aee7692f420872653 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
7dc22a271fd568f2ec7db5360ae08d2ed0dc6ceb14901bf8d3a49f6a239506be *arm-linux.elf/upx-3.95
|
||||||
|
58259c38274532baf60932569a4006ceb762a381ac3b257e9af648af24422660 *arm-wince.pe/upx-3.91.exe
|
||||||
|
f626c4131c1b70a880e6431c41842093dad4a2fff921304727306e699c6e6ceb *arm64-linux.elf/upx-3.95
|
||||||
|
6f870fe4f7a92cd244bc0b209082264ffdf68d023dc1d697f5111ce5f4a168ca *armeb-linux.elf/upx-3.91
|
||||||
|
ed554bbf0d531740a2cb408a5408b7fb67fef32173531bae21b15829e4465b92 *armeb-linux.elf/upx-3.95
|
||||||
|
6e5b040dd59e0bf3491da6947fd3c576fd1b090b1fa7f278b147dd33b0a561a4 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
f27ef0ce4ca0c7557dfd4c0c3a7e5443523f82dd9f4d354fb80ad0e001ede485 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
8e6d5979658e8a00b567ddd214abd5565fc4c356b3e84941038c16aff9b3fb23 *i386-linux.elf/upx-3.91
|
||||||
|
7d7cc62ec7f8e71e526687cde53d5b49e5f688787c3aef533a8aa9f302e51bea *i386-linux.elf/upx-3.95
|
||||||
|
f81ed2a88589df18a735bebc1b42d638d3eb0bebbaea70758c762348103adde1 *i386-win32.pe/upx-3.91.exe
|
||||||
|
d5533151370ea42679c94036b8d61239f90fd930fca5d3cedbbca9c959756294 *i386-win32.pe/upx-3.95.exe
|
||||||
|
5361b1f369a4b42f9063f448bdcda31f97bd610c659d2fe3c89d3e479a84cbc9 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
ac4233c2d342375bd2fb5cf871cfd47b58863fbcac7693937e1d15d23f09f96e *mips-linux.elf/upx-3.95
|
||||||
|
9bcae27b631736ff226d45fc143c61c55b1bbb127b77b9612ad2d123dc96d45d *mipsel-linux.elf/upx-3.91
|
||||||
|
bf735a042c3406897f1cba6a62f8f7ea631bd15f15f21a56165decfe39323c52 *mipsel-linux.elf/upx-3.95
|
||||||
|
215c0694962ab6f4ead91448722a6ddce8471abce0742e148a6626cdbdf904fa *powerpc-linux.elf/upx-3.91
|
||||||
|
82857404a03d2a21c4bff152c8da78ae3cdcdb71ad0c847256c370ce510a4f1b *powerpc-linux.elf/upx-3.95
|
||||||
|
ee860ecf8fafb5ca6a7f9c6baf316dba1c3b55553aa02f4dc254d54b32e0a61a *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
|
||||||
|
d43e28f8724cdb76deaca6581b698bd77c06a94ea37c8cf730eb38f82ce62cce *amd64-linux.elf/upx-3.91
|
||||||
|
05c7ced28df8fa967385aa85adb479a9d9928112cb28884e8382421ee7aed062 *amd64-linux.elf/upx-3.95
|
||||||
|
405399cb91cde3dfeed89bfe14ff65301fcb9a6925ffb55bdac8c60e164fec9f *amd64-win64.pe/upx-3.95.exe
|
||||||
|
48a0983b24a0dc0e29df24ee30470ce228f4c978a3e965e27a6b12d8977807bd *arm-linux.elf/upx-3.95
|
||||||
|
9b460ce1edeb2557661526bdd0d195f5d4c7c5f261c2886fe47691ce5b2d20c5 *arm-wince.pe/upx-3.91.exe
|
||||||
|
391afe58edcbbedadde8c9ec4cd693c4c169bd6f6fefa9f63c41f4d7529246c9 *arm64-linux.elf/upx-3.95
|
||||||
|
05943cb6189f8230a6a6cc8ffb9ae9b6f3ecb1ef222181522833dc8373c77211 *armeb-linux.elf/upx-3.91
|
||||||
|
0f1cdc18d24c03d3e56256721ba9fdddf7809eeaeefacf4f677120903c9544e4 *armeb-linux.elf/upx-3.95
|
||||||
|
ee2918a9bf26aebcb5547684f2d4f9c24ac516597c208a478e5bc3f36b59291e *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
f24770536216fa29a7d3624f6e676a54244be0a7ab1213d29d21a146639a1b83 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
2ea7702d4398d03ea46502f5179b2eaa209926ad0d105e81663b3c87c2e7acb7 *i386-linux.elf/upx-3.91
|
||||||
|
74df9d74515b51839272c5c84572880d58ea85a16cbed5549b2af182149dad24 *i386-linux.elf/upx-3.95
|
||||||
|
11401986fe43ee57cb0170099d3a6228238e2eff8244ad81cc647420314c98ee *i386-win32.pe/upx-3.91.exe
|
||||||
|
3ee3b313f0cf6c891c5895343ff304aa34e3017aac45022f7bbd0cfd7d80dc25 *i386-win32.pe/upx-3.95.exe
|
||||||
|
e9659acb2dc14f60e8f3d71b6024ec9c768ee11233ec9dad5e1bd252cd259381 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
0796aa39c6a069f5c940ee07442c22d864fdca7f6fe083d51debabab077c413f *mips-linux.elf/upx-3.95
|
||||||
|
98d370c61692de7249aa51f3befc3ebefa705f172a1ebf0dd092ea07b9776158 *mipsel-linux.elf/upx-3.91
|
||||||
|
7bb3afac05c13ef34721facf4c81621791a45a40cceab2cc1bb7306a747c5df5 *mipsel-linux.elf/upx-3.95
|
||||||
|
eb292cd7c95fcd597431a8e6c9f13f0b64bbda3423611a43ceeca418a3979554 *powerpc-linux.elf/upx-3.91
|
||||||
|
6a45c2734fc2aa82a0e2b9331c545e1bb04d02797c59ab00a8250d052603b8a2 *powerpc-linux.elf/upx-3.95
|
||||||
|
9c6dc09daf5901983625e8f9f2f45f66a10fcf9841ae3e9788bb3ae075db5307 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t140_compress_lzma_2_no_filter="\
|
||||||
|
8f08ea0a86c3f49c7b2a90aca17b5739a91e39ef6542365e7395d1325fdcfc2b *amd64-linux.elf/upx-3.91
|
||||||
|
9f7c9d0432baaf21977ca4bd827f7cdf7c39296f77e122689cc57945856e7b39 *amd64-linux.elf/upx-3.95
|
||||||
|
86e277047c1b8c1884bf5ceb4f628410b011fae761e8cf7031f0b8b3058adac6 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
80a8f4d0df27d32d8f20bfd838f6c876026f84d6c54bb5c1a920340031eb22e8 *arm-linux.elf/upx-3.95
|
||||||
|
c059993735be23726fd74a5d0c5165f4c6581cc90513b2a6f82cb0f8d113ca6a *arm-wince.pe/upx-3.91.exe
|
||||||
|
3b8298af00f656d071187fc219bbb9a131a412f7489dc7a164fa7c6a78c96c85 *arm64-linux.elf/upx-3.95
|
||||||
|
83d0c4dc17bbb9391d904c85c6382fee5b8f76baf664f14c8f7c3c0b31bc8079 *armeb-linux.elf/upx-3.91
|
||||||
|
f939c8365f00d486573f9b969d42d1b43e49fc8c5f59b3a72eb229482de3938e *armeb-linux.elf/upx-3.95
|
||||||
|
467cead4f4418d1a581ac61cac5526afdbb6ebe8887749c3b8b25a45bb686e22 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
c35eb28139afcea4b03e7fabf993e9927486b53e0ca20d78e61a274358934ad3 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
6898de07c4d250dfdd9be431a59562e87f49e2c69112d034352d1ec62c6e99dd *i386-linux.elf/upx-3.91
|
||||||
|
400f08c53c7b3d81e99c85f9aa86443616d884a366627f61dce3f1d0c46c67ba *i386-linux.elf/upx-3.95
|
||||||
|
2530b702024091f71405e5a8b4b0ebc235a8e12bcb66867590d1a6741c905b9d *i386-win32.pe/upx-3.91.exe
|
||||||
|
2a854af2416d459b7bdf8345cae374800cf471d9e945a170fa38046221e7b462 *i386-win32.pe/upx-3.95.exe
|
||||||
|
74ac6483e4a98a4173330ad43203f04354af0bc1ce046e6c94e5759d68ce992f *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
118fd0c794402cf96c4c97533c2a3292afdc87632bac6a25978f0baae248e375 *mips-linux.elf/upx-3.95
|
||||||
|
4b26db733fab84d8032dd4c6cc345f3da50ac3fe581706b1676ebe19d099c693 *mipsel-linux.elf/upx-3.91
|
||||||
|
a016e09a4aa299dd176a6e5eccde98db8781c509e7605504c316a77bf55fe1a1 *mipsel-linux.elf/upx-3.95
|
||||||
|
db75012b5177ef021fb9365c3828aba39ea7feff0783e737a4625c0066de8ef1 *powerpc-linux.elf/upx-3.91
|
||||||
|
168931dfcecc39019fa86eb2e27dfc2e8239160c3b826b76fd53f39f13f986da *powerpc-linux.elf/upx-3.95
|
||||||
|
e58fb39928d60ec18add81e3dcc62b5a82cfa8c9c19f89ade0a7388ac88342f5 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t150_compress_ucl_2_all_filters="\
|
||||||
|
c329512f59d065b20698c49ff7d710c7bb0cf099b8a4b8fe5ecd1121a12eb175 *amd64-linux.elf/upx-3.91
|
||||||
|
8cf09664da89c51453e23c4ac76e8d619814dbd576580f408ebf95078dc67474 *amd64-linux.elf/upx-3.95
|
||||||
|
8af657df3b6a0f7d586f38960a592827921a914f923db4ab87fbb93094f1096d *amd64-win64.pe/upx-3.95.exe
|
||||||
|
055f5fd681f872e2e308a59402196bb3f33fdb0ef34ddee4031f7d676e6ac364 *arm-linux.elf/upx-3.95
|
||||||
|
eae07f1e169d0b89ec80fac5f61ce41af9c697d48ddb45495806f9e3103dd0ac *arm-wince.pe/upx-3.91.exe
|
||||||
|
b1bfa0d71d8dfd3edd772d1d92f76695155ba9cbcdc572c68efa8cd6e500b0b6 *arm64-linux.elf/upx-3.95
|
||||||
|
12af497fbc9d06199fa623744a31778ee78fe142e5958162f0e683809ca58435 *armeb-linux.elf/upx-3.91
|
||||||
|
b497a7fb0b12fb75a4444f0c137e174fe059b973f5f2425b1eedb04855dfb130 *armeb-linux.elf/upx-3.95
|
||||||
|
1c7d4abe5aa21da343399e2cff642f04bf0904bbac2df97d5e10b2e9087806fd *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
70ae2c3a58b22dbf1aefb145705c00855be241e6b2cc45fe18cd90bf93fa3802 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
f332cba5e96fa04377a127c2c7f45822ccf1f12dd990fca5bf73499902082c3b *i386-linux.elf/upx-3.91
|
||||||
|
15f1238bd48835d850c4eb9bb51515738d69237b6c81bd7148aefb0a0e4556e6 *i386-linux.elf/upx-3.95
|
||||||
|
1c00860e202116b199fa76b4b508f27d7ec28510d8287557d04688c93be4e624 *i386-win32.pe/upx-3.91.exe
|
||||||
|
12e1ac68a55bae0c2f82149b133e21224e37168e9915ef97bd40d38455723a53 *i386-win32.pe/upx-3.95.exe
|
||||||
|
ae43a71d76b0bc2f1af2e9b5ec90d6cc0337dbd603d124dfac8c68893bd8fb5f *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
e0c0dd0e41b3d0f059d373bbc81c35fdb843657d496614fd090aa2d89ed5da27 *mips-linux.elf/upx-3.95
|
||||||
|
558780a870830f5fbb14f5cd00db576fa37c8fcd72f7f22491ca2279aaf85757 *mipsel-linux.elf/upx-3.91
|
||||||
|
7d85974f25e3daa3f21c11496683bee6c22d1c6086f29ed5b410637cb9c66f2e *mipsel-linux.elf/upx-3.95
|
||||||
|
cb3c36ee3ade39e4cb1c2d5bb20548f1f4560bf1853c315b5c2b3fca533c75ec *powerpc-linux.elf/upx-3.91
|
||||||
|
faaf09644ef9eb51a5f48a34971bb6ab363cb85fb79fdba8ad9eb1aecd7d5a7e *powerpc-linux.elf/upx-3.95
|
||||||
|
c714496c2027d81cd16431cc27dc105761aae98d71099cecae84bd1d269e9dba *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
|
||||||
|
08a685a5869892597aa82264e8796a6d0e663f61426b683cfb47a51c5f4e1f37 *amd64-linux.elf/upx-3.91
|
||||||
|
ea0ef4eed5ecfa14f5e713bae4a7559adcd8dc5bf26a6bc035d771063cf325eb *amd64-linux.elf/upx-3.95
|
||||||
|
d5cbc1908d75808afffaa503584588aa33ef3ce36692273c0d7ae628fe649fc6 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
a90a668fb46aa1ae1ebe875383930f016ea3ca9985f8a6d0d09bcef179cee7ab *arm-linux.elf/upx-3.95
|
||||||
|
ad3d1c557d82f8d4d54a462b5e720705b51df064141b0fd3f81d54de685f51d6 *arm-wince.pe/upx-3.91.exe
|
||||||
|
1b2f673515ca9b67c7af0a9381d4e2b7f23b709e97ae969cf1dedcfda8b254ef *arm64-linux.elf/upx-3.95
|
||||||
|
ef2ce0aace6ea8c6994232c93b73d2b0fda6ccc2b108bfca6a0f4d4dbacc36d0 *armeb-linux.elf/upx-3.91
|
||||||
|
2bfdc5e22932b32d405611d51940d7a79b851e3776b8cdb05db5112a195cc624 *armeb-linux.elf/upx-3.95
|
||||||
|
a9b09a6118386855e0b326e337f72c8dd369b3cadfb4e1d35a08c197a71ec0f6 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
4cedba26f462707805fef1810d720e09b25040f97344444d93c0af36923e8089 *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
7fdf110134d120d6cec0aea13c1a7b861770cecb4f516cd1ab595a4d3d26936f *i386-linux.elf/upx-3.91
|
||||||
|
deb15af9198da2d8e2d95b5f5e64bd8639cb97d4cfe2484eabdcd6385288b964 *i386-linux.elf/upx-3.95
|
||||||
|
40fcff57d7859f37d349b907a4564bf3e9ba7223cc163e770f8353a8bfa51c73 *i386-win32.pe/upx-3.91.exe
|
||||||
|
fae3dc1dc8eac23f6e610a1e01c20d4779026511a091672f7c150c402ae1c552 *i386-win32.pe/upx-3.95.exe
|
||||||
|
f9663e80b6d0f69cc916ae137f6df9cd8c10bfff9c1562959efd32e91b02e1a8 *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
50b71e6090c7964bb704849584c7c75d8ee5aaa5bfab26482d3879bc01d17841 *mips-linux.elf/upx-3.95
|
||||||
|
cb7d16ae50a2eb464c1f864f1b9052cc66f52545b82d636e48b2105e797e31f7 *mipsel-linux.elf/upx-3.91
|
||||||
|
a1052f7425c434ce0f92dbb292d6511c8af1698a2e88352f7a463711ef8115c6 *mipsel-linux.elf/upx-3.95
|
||||||
|
5fcc6323a8cd37d83e9a9136d7d2511a3e5c59216ceab50d4f386a2ae1a6c842 *powerpc-linux.elf/upx-3.91
|
||||||
|
a905cb39a96982ab08e2663be690cd400bd54646b50ee50790de51b322d09830 *powerpc-linux.elf/upx-3.95
|
||||||
|
071b42a5ae7bf3d25f01e436473433470b97311ac2aff834884a0d3d240d0291 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
|
||||||
|
c5ed17847125467790aa635c926075768925ab88c3a6baa57b3bf2877c6b9001 *amd64-linux.elf/upx-3.91
|
||||||
|
a17594fae504de512492ef822675cf6faac74e48c7803ac119626148ea9adb89 *amd64-linux.elf/upx-3.95
|
||||||
|
1ea4c9aedd3591f62cd6902986c1df39d3ef7fc624abc78bde61300e87627d20 *amd64-win64.pe/upx-3.95.exe
|
||||||
|
319e96fc0a6dbaa3aa7214100176957d4d0e84b7d0ee849a1f60c34ba5a22947 *arm-linux.elf/upx-3.95
|
||||||
|
a3f2144754b44700b4aacb39ab5f5b818fda7caa0a934090eeacee7dafb6ba7b *arm-wince.pe/upx-3.91.exe
|
||||||
|
5cb0a03d3305ddd5bc77990538b49ce3f14dcd03ad76d272d45005aa86dd5f7d *arm64-linux.elf/upx-3.95
|
||||||
|
f5061f76060445a72edb898e9919400e81423bde6dad566a5bb5bdf1407ef6dc *armeb-linux.elf/upx-3.91
|
||||||
|
337e4776b2f1afec7eb6d54c34d68f166af63ce5b4e2fb7ac48eeb5b83582c28 *armeb-linux.elf/upx-3.95
|
||||||
|
46223cc5aea67b275cc5621eec79f97d4f543edecfdac37a0f2407583f881fc9 *i386-dos32.djgpp2.coff/upx-3.91.exe
|
||||||
|
228c9007c5395fc9eef93a23d781e7daab01efa1ee86a4d4f6a46b9b7f7aeb8b *i386-dos32.djgpp2.coff/upx-3.95.exe
|
||||||
|
089693d8059d8580ea3bf326d038ffb51f258721833ad96c05f20c321ab8df13 *i386-linux.elf/upx-3.91
|
||||||
|
d4995b5b5c46eef7f8f1673c629f427d19b5dbda495c2b3f157acf4046b72123 *i386-linux.elf/upx-3.95
|
||||||
|
dd70e8fde421a35692f26147c3eba392f57adb332d0e5025fa0039a2673c10cb *i386-win32.pe/upx-3.91.exe
|
||||||
|
3fa365f39199afc7a259ba8ad8ae50cd026ef3f0a37d3fd570d42cba8bc5e0e7 *i386-win32.pe/upx-3.95.exe
|
||||||
|
1b2f9a97731805dafef6961656bd29d7e983320a5626fe88ba987bf267bef32a *m68k-atari.tos/upx-3.91.ttp
|
||||||
|
21febba6606d89c4a0f72a7f07f55d90268da48b97c65d23647c021c2e26b7c4 *mips-linux.elf/upx-3.95
|
||||||
|
7a0892428e07493578d59f16adc0e6f5959f3d5a437e818375ff9fbf8ba42d2f *mipsel-linux.elf/upx-3.91
|
||||||
|
ecf7d97388e48f2ad27a06ab8f4027e165e5a34f577f7b4fec3928a946557d60 *mipsel-linux.elf/upx-3.95
|
||||||
|
171393e34d004f04040067080b4b48d08030708bd30bcea593f554ed13b4ddb8 *powerpc-linux.elf/upx-3.91
|
||||||
|
0b97ff1ed48d19e64120cd4fac5f4e76da6ea6f3ec1fda5cada11aa2142d045a *powerpc-linux.elf/upx-3.95
|
||||||
|
0c825675a076c7b9f73ae0292527e3d569b5c0b33298b9f48b7bdd3084115c69 *powerpc64le-linux.elf/upx-3.95
|
||||||
|
"
|
||||||
|
########## end .sha256sums.recreate
|
||||||
@@ -0,0 +1,287 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
#
|
||||||
|
# very first version of the upx-testsuite
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $TRAVIS_OS_NAME == osx ]]; then
|
||||||
|
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
else
|
||||||
|
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
|
||||||
|
fi
|
||||||
|
source "$argv0dir/travis_init.sh" || exit 1
|
||||||
|
|
||||||
|
if [[ $BM_T =~ (^|\+)SKIP($|\+) ]]; then
|
||||||
|
echo "UPX testsuite SKIPPED."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [[ $BM_X == rebuild-stubs ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# convenience
|
||||||
|
[[ -f $upx_exe ]] && upx_exe=$(readlink -en -- "$upx_exe")
|
||||||
|
|
||||||
|
# create dirs
|
||||||
|
cd / || exit 1
|
||||||
|
if [[ ! -d "$upx_testsuite_SRCDIR/files/packed" ]]; then
|
||||||
|
echo 'invalid or missing $upx_testsuite_SRCDIR:'
|
||||||
|
echo ' please git clone https://github.com/upx/upx-testsuite'
|
||||||
|
echo ' and set (export) the envvar upx_testsuite_SRCDIR to the local file path'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
mkbuilddirs "$upx_testsuite_BUILDDIR"
|
||||||
|
cd / && cd "$upx_testsuite_BUILDDIR" || exit 1
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // support functions
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testsuite_header() {
|
||||||
|
print_header "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_split_f() {
|
||||||
|
fd=$(dirname "$1")
|
||||||
|
fb=$(basename "$1")
|
||||||
|
fsubdir=$(basename "$fd")
|
||||||
|
# sanity checks
|
||||||
|
if [[ ! -f $1 || -z $fsubdir || -z $fb ]]; then
|
||||||
|
fd= fb= fsubdir=
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_check_sha() {
|
||||||
|
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
|
||||||
|
echo
|
||||||
|
cat $1/.sha256sums.current
|
||||||
|
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
|
||||||
|
echo "UPX-ERROR: $1 FAILED: checksum mismatch"
|
||||||
|
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
|
||||||
|
exit_code=99
|
||||||
|
let num_errors+=1 || true
|
||||||
|
all_errors="${all_errors} $1"
|
||||||
|
#exit 99
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_check_sha_decompressed() {
|
||||||
|
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
|
||||||
|
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
|
||||||
|
cat $1/.sha256sums.current
|
||||||
|
echo "UPX-ERROR: FATAL: $1 FAILED: decompressed checksum mismatch"
|
||||||
|
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
|
||||||
|
exit 98
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
testsuite_use_canonicalized=1
|
||||||
|
testsuite_run_compress() {
|
||||||
|
testsuite_header $testdir
|
||||||
|
local files f
|
||||||
|
if [[ $testsuite_use_canonicalized == 1 ]]; then
|
||||||
|
files=t020_canonicalized/*/*
|
||||||
|
else
|
||||||
|
files=t010_decompressed/*/*
|
||||||
|
fi
|
||||||
|
for f in $files; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir $testdir/.decompressed/$fsubdir
|
||||||
|
$upx_run -qq --prefer-ucl "$@" $f -o $testdir/$fsubdir/$fb
|
||||||
|
$upx_run -qq -d $testdir/$fsubdir/$fb -o $testdir/.decompressed/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
$upx_run -qq -l $testdir/*/*
|
||||||
|
$upx_run -qq --file-info $testdir/*/*
|
||||||
|
$upx_run -q -t $testdir/*/*
|
||||||
|
if [[ $testsuite_use_canonicalized == 1 ]]; then
|
||||||
|
# check that after decompression the file matches the canonicalized version
|
||||||
|
cp t020_canonicalized/.sha256sums.expected $testdir/.decompressed/
|
||||||
|
testsuite_check_sha_decompressed $testdir/.decompressed
|
||||||
|
rm -rf "./$testdir/.decompressed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // expected checksums
|
||||||
|
# //
|
||||||
|
# // To ease maintenance of this script in case of updates this section
|
||||||
|
# // can be automatically re-created from the current checksums -
|
||||||
|
# // see call of function recreate_expected_sha256sums below.
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
recreate_expected_sha256sums() {
|
||||||
|
local o=$1
|
||||||
|
local files f d
|
||||||
|
echo "########## begin .sha256sums.recreate" > "$o"
|
||||||
|
files=*/.sha256sums.current
|
||||||
|
for f in $files; do
|
||||||
|
d=$(dirname "$f")
|
||||||
|
echo "expected_sha256sums__${d}="'"\' >> "$o"
|
||||||
|
cat "$f" >> "$o"
|
||||||
|
echo '"' >> "$o"
|
||||||
|
done
|
||||||
|
echo "########## end .sha256sums.recreate" >> "$o"
|
||||||
|
}
|
||||||
|
|
||||||
|
source "$argv0dir/travis_testsuite_1-expected_sha256sums.sh" || exit 1
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // init
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
#set -x # debug
|
||||||
|
exit_code=0
|
||||||
|
num_errors=0
|
||||||
|
all_errors=
|
||||||
|
|
||||||
|
if [[ $BM_T =~ (^|\+)ALLOW_FAIL($|\+) ]]; then
|
||||||
|
echo "ALLOW_FAIL"
|
||||||
|
set +e
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.out ]] && upx_exe=$upx_BUILDDIR/upx.out
|
||||||
|
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.exe ]] && upx_exe=$upx_BUILDDIR/upx.exe
|
||||||
|
if [[ -z $upx_exe ]]; then exit 1; fi
|
||||||
|
upx_run=$upx_exe
|
||||||
|
if [[ $BM_T =~ (^|\+)qemu($|\+) && -n $upx_qemu ]]; then
|
||||||
|
upx_run="$upx_qemu $upx_qemu_flags -- $upx_exe"
|
||||||
|
fi
|
||||||
|
if [[ $BM_T =~ (^|\+)wine($|\+) && -n $upx_wine ]]; then
|
||||||
|
upx_run="$upx_wine $upx_wine_flags $upx_exe"
|
||||||
|
fi
|
||||||
|
if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then
|
||||||
|
if [[ -z $upx_valgrind ]]; then
|
||||||
|
upx_valgrind="valgrind"
|
||||||
|
fi
|
||||||
|
if [[ -z $upx_valgrind_flags ]]; then
|
||||||
|
#upx_valgrind_flags="--leak-check=full --show-reachable=yes"
|
||||||
|
#upx_valgrind_flags="-q --leak-check=no --error-exitcode=1"
|
||||||
|
upx_valgrind_flags="--leak-check=no --error-exitcode=1"
|
||||||
|
fi
|
||||||
|
upx_run="$upx_valgrind $upx_valgrind_flags $upx_exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
|
||||||
|
(cd / && cd "$upx_BUILDDIR" && lcov -d . --zerocounters)
|
||||||
|
fi
|
||||||
|
|
||||||
|
export UPX="--prefer-ucl --no-color --no-progress"
|
||||||
|
export UPX_DEBUG_DISABLE_GITREV_WARNING=1
|
||||||
|
export UPX_DEBUG_DOCTEST_VERBOSE=0
|
||||||
|
|
||||||
|
# let's go
|
||||||
|
if ! $upx_run --version-short; then echo "UPX-ERROR: FATAL: upx --version-short FAILED"; exit 1; fi
|
||||||
|
if ! $upx_run -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
|
||||||
|
if ! $upx_run --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
|
||||||
|
rm -rf ./testsuite_1
|
||||||
|
mkbuilddirs testsuite_1
|
||||||
|
cd testsuite_1 || exit 1
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // decompression tests
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testdir=t010_decompressed
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
|
||||||
|
testsuite_header $testdir
|
||||||
|
for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.9[15]*; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir
|
||||||
|
$upx_run -qq -d $f -o $testdir/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
|
||||||
|
# run one pack+unpack step to canonicalize the files
|
||||||
|
testdir=t020_canonicalized
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
|
||||||
|
testsuite_header $testdir
|
||||||
|
for f in t010_decompressed/*/*; do
|
||||||
|
testsuite_split_f $f
|
||||||
|
[[ -z $fb ]] && continue
|
||||||
|
echo "# $f"
|
||||||
|
mkdir -p $testdir/$fsubdir/.packed
|
||||||
|
$upx_run -qq --prefer-ucl -1 $f -o $testdir/$fsubdir/.packed/$fb
|
||||||
|
$upx_run -qq -d $testdir/$fsubdir/.packed/$fb -o $testdir/$fsubdir/$fb
|
||||||
|
done
|
||||||
|
testsuite_check_sha $testdir
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // compression tests
|
||||||
|
# // info: we use fast compression levels because we want to
|
||||||
|
# // test UPX and not the compression libraries
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
testdir=t110_compress_ucl_nrv2b_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2b -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t120_compress_ucl_nrv2d_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2d -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t130_compress_ucl_nrv2e_3_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --nrv2e -3 --no-filter
|
||||||
|
|
||||||
|
testdir=t140_compress_lzma_2_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --lzma -2 --no-filter
|
||||||
|
|
||||||
|
testdir=t150_compress_ucl_2_all_filters
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress -2 --all-filters
|
||||||
|
|
||||||
|
testdir=t160_compress_all_methods_1_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --all-methods -1 --no-filter
|
||||||
|
|
||||||
|
testdir=t170_compress_all_methods_no_lzma_5_no_filter
|
||||||
|
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
|
||||||
|
time testsuite_run_compress --all-methods --no-lzma -5 --no-filter
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# // summary
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
# recreate checksums from current version for an easy update in case of changes
|
||||||
|
recreate_expected_sha256sums .sha256sums.recreate
|
||||||
|
|
||||||
|
testsuite_header "UPX testsuite summary"
|
||||||
|
if ! $upx_run --version-short; then
|
||||||
|
echo "UPX-ERROR: upx --version-short FAILED"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "upx_exe='$upx_exe'"
|
||||||
|
if [[ $upx_run != "$upx_exe" ]]; then
|
||||||
|
echo "upx_run='$upx_run'"
|
||||||
|
fi
|
||||||
|
if [[ -f $upx_exe ]]; then
|
||||||
|
ls -l "$upx_exe"
|
||||||
|
file "$upx_exe" || true
|
||||||
|
fi
|
||||||
|
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
|
||||||
|
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
|
||||||
|
echo ".sha256sums.{expected,current}:"
|
||||||
|
cat */.sha256sums.expected | LC_ALL=C sort | wc
|
||||||
|
cat */.sha256sums.current | LC_ALL=C sort | wc
|
||||||
|
echo
|
||||||
|
if [[ $exit_code == 0 ]]; then
|
||||||
|
echo "UPX testsuite passed. All done."
|
||||||
|
else
|
||||||
|
echo "UPX-ERROR: UPX testsuite FAILED:${all_errors}"
|
||||||
|
echo "UPX-ERROR: UPX testsuite FAILED with $num_errors error(s). See log file."
|
||||||
|
fi
|
||||||
|
exit $exit_code
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
# Support for GitHub Actions -- https://github.com/features/actions
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
# note: GitHub Actions runner images are frequently updated, and
|
||||||
|
# unfortunately this sometimes breaks builds in mysterious ways...
|
||||||
|
# see https://github.com/actions/runner-images.git
|
||||||
|
|
||||||
|
name: 'CI'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
- '!appveyor*'
|
||||||
|
- '!gitlab*'
|
||||||
|
- '!travis*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
UPX_CMAKE_BUILD_FLAGS: --verbose
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
job-rebuild-and-verify-stubs:
|
||||||
|
name: 'Rebuild stubs'
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: 'Install extra packages'
|
||||||
|
run: |
|
||||||
|
uname -a; pwd; id; umask
|
||||||
|
cd ..; mkdir -p deps; cd deps; mkdir packages
|
||||||
|
# for ubuntu-22.04: install python2
|
||||||
|
##export DEBIAN_FRONTEND=noninteractive
|
||||||
|
##sudo apt-get install -y --no-install-recommends python2-minimal
|
||||||
|
# manually install compat libs from Ubuntu 16.04
|
||||||
|
wget -q 'http://mirror.enzu.com/ubuntu/pool/main/g/gmp/libgmp10_6.1.0+dfsg-2_amd64.deb'
|
||||||
|
wget -q 'http://mirror.enzu.com/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd64.deb'
|
||||||
|
for f in *.deb; do dpkg -x $f ./packages; done
|
||||||
|
sudo mv -v -n ./packages/usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/
|
||||||
|
sudo ldconfig
|
||||||
|
wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20210104/bin-upx-20210104.tar.xz | tar -xJ
|
||||||
|
- name: 'Check out code'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: 'Rebuild and verify stubs'
|
||||||
|
run: |
|
||||||
|
env C=gcc X=rebuild-stubs TRAVIS_OS_NAME=linux bash ./.github/travis_build.sh
|
||||||
|
- name: 'Check source code formatting'
|
||||||
|
run: |
|
||||||
|
bash ./misc/scripts/check_whitespace_git.sh
|
||||||
|
env UPX_CLANG_FORMAT="$PWD/../deps/bin-upx-20210104/clang-format-10.0.1" make -C src clang-format
|
||||||
|
if ! git diff --quiet; then git diff; exit 1; fi
|
||||||
|
|
||||||
|
job-linux-cmake:
|
||||||
|
needs: [ job-rebuild-and-verify-stubs ]
|
||||||
|
name: ${{ format('{0} cmake', matrix.os) }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { os: ubuntu-20.04 }
|
||||||
|
- { os: ubuntu-22.04 }
|
||||||
|
steps:
|
||||||
|
- name: 'Check out code'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: 'Build cmake debug-gcc'
|
||||||
|
run: 'make build/debug-gcc'
|
||||||
|
- name: 'Build cmake release-gcc'
|
||||||
|
run: 'make build/release-gcc'
|
||||||
|
- name: 'Build cmake debug-clang'
|
||||||
|
run: 'make build/debug-clang'
|
||||||
|
- name: 'Build cmake release-clang'
|
||||||
|
run: 'make build/release-clang'
|
||||||
|
- name: 'Make artifact'
|
||||||
|
run: |
|
||||||
|
N=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}
|
||||||
|
mkdir -p "tmp/artifact/$N"
|
||||||
|
(cd build && cp -ai --parents */upx "../tmp/artifact/$N")
|
||||||
|
(cd tmp/artifact && tar --sort=name -czf "$N.tar.gz" "$N" && rm -rf "./$N")
|
||||||
|
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||||
|
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||||
|
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_name }}
|
||||||
|
path: tmp/artifact
|
||||||
|
- name: 'Run basic tests'
|
||||||
|
run: |
|
||||||
|
make -C build/debug-gcc test
|
||||||
|
make -C build/release-gcc test
|
||||||
|
make -C build/debug-clang test
|
||||||
|
make -C build/release-clang test
|
||||||
|
|
||||||
|
job-macos-cmake:
|
||||||
|
needs: [ job-rebuild-and-verify-stubs ]
|
||||||
|
name: ${{ format('{0} cmake', matrix.os) }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { os: macos-11, gcc: gcc-10, gxx: 'g++-10' }
|
||||||
|
# { os: macos-12, gcc: gcc-11, gxx: 'g++-11' } # disable gcc - XCode 14.0 ld bug
|
||||||
|
- { os: macos-12 }
|
||||||
|
steps:
|
||||||
|
- name: 'Check out code'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: 'Build cmake debug-gcc'
|
||||||
|
if: ${{ matrix.gcc != '' }}
|
||||||
|
run: 'make build/debug-gcc CC=${{ matrix.gcc }} CXX=${{ matrix.gxx }}'
|
||||||
|
- name: 'Build cmake release-gcc'
|
||||||
|
if: ${{ matrix.gcc != '' }}
|
||||||
|
run: 'make build/release-gcc CC=${{ matrix.gcc }} CXX=${{ matrix.gxx }}'
|
||||||
|
- name: 'Build cmake debug-clang'
|
||||||
|
run: 'make build/debug-clang'
|
||||||
|
- name: 'Build cmake release-clang'
|
||||||
|
run: 'make build/release-clang'
|
||||||
|
- name: 'Make artifact'
|
||||||
|
run: |
|
||||||
|
N=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}
|
||||||
|
mkdir -p "tmp/artifact/$N"
|
||||||
|
(cd build && rsync -R -a */upx "../tmp/artifact/$N/")
|
||||||
|
(cd tmp/artifact && gtar --sort=name -czf "$N.tar.gz" "$N" && rm -rf "./$N")
|
||||||
|
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||||
|
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||||
|
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_name }}
|
||||||
|
path: tmp/artifact
|
||||||
|
- name: 'Run basic tests'
|
||||||
|
run: |
|
||||||
|
make -C build/debug-clang test
|
||||||
|
make -C build/release-clang test
|
||||||
|
|
||||||
|
job-windows-cmake:
|
||||||
|
needs: [ job-rebuild-and-verify-stubs ]
|
||||||
|
name: ${{ format('{0} cmake', matrix.os) }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# windows-2019 used to work but got broken with the 20220821.1
|
||||||
|
# runner-image update; disable for now
|
||||||
|
# see https://github.com/actions/runner-images.git
|
||||||
|
####- { os: windows-2019 }
|
||||||
|
- { os: windows-2022 }
|
||||||
|
steps:
|
||||||
|
- name: 'Check out code'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: 'Inspect runner-image settings'
|
||||||
|
# see https://github.com/actions/runner-images.git
|
||||||
|
if: ${{ false }}
|
||||||
|
run: |
|
||||||
|
Get-Command bash; Get-Command cmake; Get-Command make
|
||||||
|
bash --version; cmake --version; make --version
|
||||||
|
Get-Command cl -ErrorAction SilentlyContinue
|
||||||
|
- name: 'Build cmake debug'
|
||||||
|
run: 'make build/debug'
|
||||||
|
- name: 'Build cmake release'
|
||||||
|
run: 'make build/release'
|
||||||
|
- name: 'Make artifact'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
N=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}
|
||||||
|
mkdir -p "tmp/artifact/$N"
|
||||||
|
(cd build && cp -ai --parents */*/upx.exe "../tmp/artifact/$N")
|
||||||
|
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||||
|
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||||
|
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_name }}
|
||||||
|
path: tmp/artifact
|
||||||
|
- name: 'Run basic tests'
|
||||||
|
run: |
|
||||||
|
cmake --build build/debug --config Debug --target RUN_TESTS
|
||||||
|
cmake --build build/release --config Release --target RUN_TESTS
|
||||||
|
|
||||||
|
job-windows-toolchains:
|
||||||
|
needs: [ job-rebuild-and-verify-stubs ]
|
||||||
|
name: ${{ matrix.name }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
C: ${{ matrix.C }}
|
||||||
|
B: release
|
||||||
|
H: 'd:\a\upx'
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { name: amd64-win64-msvc-14.2, os: windows-2019, C: msvc-14.2-x64, A: x64 }
|
||||||
|
- { name: amd64-win64-msvc-14.3, os: windows-2022, C: msvc-14.3-x64, A: x64 }
|
||||||
|
- { name: i386-win32-msvc-14.2, os: windows-2019, C: msvc-14.2-x86, A: x86 }
|
||||||
|
- { name: i386-win32-msvc-14.3, os: windows-2022, C: msvc-14.3-x86, A: x86 }
|
||||||
|
steps:
|
||||||
|
- name: 'Check out code'
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: 'Prepare sources'
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
where bash & where cat & where chmod & where cmp & where cp & where curl & where date & where file & where git & where gzip & where mkdir & where mv & where openssl & where readlink & where rm & where rmdir & where sed & where sha256sum & where sort & where ssh & where ssh-add & where ssh-agent & where ssh-keyscan & where tar & where touch
|
||||||
|
git config --global core.autocrlf input
|
||||||
|
git --version & bash --version
|
||||||
|
cd %H%
|
||||||
|
md build build\%C% deps
|
||||||
|
cd deps
|
||||||
|
git clone --depth=1 https://github.com/upx/upx-testsuite
|
||||||
|
- name: 'Set up Developer Command Prompt'
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.A }}
|
||||||
|
- name: 'Build'
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
@REM setup directories following the VPATH build in travis_build.sh
|
||||||
|
where cl & where link
|
||||||
|
set BDIR=%H%\build\%C%\%B%
|
||||||
|
md %BDIR% %BDIR%\ucl %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib
|
||||||
|
set DEFS=-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS
|
||||||
|
git rev-parse --short=12 HEAD > %BDIR%\upx\.GITREV.txt
|
||||||
|
@REM ===== build UCL =====
|
||||||
|
cd %BDIR%\ucl
|
||||||
|
set s=%H%\upx\vendor\ucl
|
||||||
|
cl -MT -J -O2 -W4 %DEFS% -I%s%\include -I%s% -c %s%\src\*.c
|
||||||
|
link -lib -out:ucl.lib *.obj
|
||||||
|
@REM ===== build zlib =====
|
||||||
|
cd %BDIR%\zlib
|
||||||
|
cl -MT -J -O2 -W3 %DEFS% -c %H%\upx\vendor\zlib\*.c
|
||||||
|
link -lib -out:zlib.lib *.obj
|
||||||
|
@REM ===== build UPX =====
|
||||||
|
cd %BDIR%\upx
|
||||||
|
set s=%H%\upx\src
|
||||||
|
cat .GITREV.txt
|
||||||
|
set /p GITREV=<.GITREV.txt
|
||||||
|
cl -MT -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -I%H%\upx\vendor -Feupx.exe %s%\*.cpp %s%\util\*.cpp %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
|
||||||
|
- name: 'Make artifact'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
N=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.name }}
|
||||||
|
mkdir -p "tmp/artifact/$N/$B"
|
||||||
|
cp -ai ../build/$C/$B/upx/upx*.exe "tmp/artifact/$N/$B"
|
||||||
|
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||||
|
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||||
|
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_name }}
|
||||||
|
path: tmp/artifact
|
||||||
|
- name: 'Run basic tests'
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = 'stop'
|
||||||
|
$ErrorView = 'NormalView'
|
||||||
|
cd $Env:H\build\$Env:C\$Env:B\upx
|
||||||
|
$Env:UPX = "--no-color --no-progress"
|
||||||
|
.\upx.exe --version
|
||||||
|
.\upx.exe upx.exe -o upx_packed.exe
|
||||||
|
dir *.exe
|
||||||
|
.\upx.exe -l upx_packed.exe
|
||||||
|
.\upx.exe -t upx_packed.exe
|
||||||
|
.\upx_packed.exe --version
|
||||||
|
- name: 'Run test suite'
|
||||||
|
run: |
|
||||||
|
bash ./.github/travis_testsuite_1.sh
|
||||||
|
|
||||||
|
# vim:set ts=2 sw=2 et:
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# see https://docs.github.com/en/actions/managing-issues-and-pull-requests/closing-inactive-issues
|
||||||
|
# see https://github.com/actions/stale
|
||||||
|
|
||||||
|
# Automatically closing issues is far from perfect, but then we only have
|
||||||
|
# limited resources and this approach favors issues that people
|
||||||
|
# actually care about.
|
||||||
|
#
|
||||||
|
# also see:
|
||||||
|
# "Should I Stale or Should I Close? An Analysis of a Bot that Closes
|
||||||
|
# Abandoned Issues and Pull Request".
|
||||||
|
# https://igorwiese.com/images/papers/Paper_BotSE_19.pdf
|
||||||
|
|
||||||
|
name: 'Close inactive issues'
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "30 6 * * 4"
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
close-issues:
|
||||||
|
name: 'Close inactive issues'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v6
|
||||||
|
with:
|
||||||
|
# operations-per-run: 300
|
||||||
|
days-before-stale: 60
|
||||||
|
days-before-close: 30
|
||||||
|
stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Please remove the stale label or add a comment or this issue will be closed in 30 days.'
|
||||||
|
stale-pr-message: 'This PR is stale because it has been open 60 days with no activity. Please remove the stale label or add a comment or this PR will be closed in 30 days.'
|
||||||
|
close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
|
||||||
|
close-pr-message: 'This PR was closed because it has been stalled for 30 days with no activity. Please feel free to reopen.'
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "devel", "devel4", "devel5", "master" ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ "devel", "devel4", "devel5" ]
|
||||||
|
schedule:
|
||||||
|
- cron: '20 1 * * 3'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'cpp' ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with: { submodules: true }
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v2
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
name: 'Close pull requests'
|
||||||
|
on:
|
||||||
|
#pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
close-pull-requests:
|
||||||
|
name: 'Close pull requests'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: 'Close pull requests'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh pr list --repo='${{ github.repository }}' --state=open --json=number | jq '.[].number' | xargs -r -n1 -- gh pr close --repo='${{ github.repository }}'
|
||||||
+47
-11
@@ -1,13 +1,49 @@
|
|||||||
.bzr*
|
/.hg*
|
||||||
.darcs*
|
/.vscode*
|
||||||
.git*
|
/Makevars.global*
|
||||||
.hg*
|
/build*
|
||||||
_darcs
|
/maint*
|
||||||
B
|
/vendor*
|
||||||
build*
|
|
||||||
doxygen
|
.depend
|
||||||
maint
|
|
||||||
ChangeLog.cvs*
|
|
||||||
GNUmakefile
|
GNUmakefile
|
||||||
MMakefile
|
MMakefile
|
||||||
TODO.*
|
Makevars.local*
|
||||||
|
tmp-testsuite*
|
||||||
|
|
||||||
|
*.a
|
||||||
|
*.d
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*.lib
|
||||||
|
*.map
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.out
|
||||||
|
*.py[cdo]
|
||||||
|
*.so
|
||||||
|
*.swp
|
||||||
|
*.ttp
|
||||||
|
|
||||||
|
doc/*.man
|
||||||
|
doc/*.ps
|
||||||
|
doc/*.tex
|
||||||
|
|
||||||
|
src/stub/**/.*-stamp
|
||||||
|
src/stub/**/MMakefile
|
||||||
|
src/stub/tmp*/*.bin
|
||||||
|
src/stub/tmp*/*.bin.bindump
|
||||||
|
src/stub/tmp*/*.bin.disasm
|
||||||
|
src/stub/tmp*/*.d
|
||||||
|
src/stub/tmp*/*.o
|
||||||
|
src/stub/tmp*/*.o.disasm
|
||||||
|
src/stub/tmp*/mips.r3000-*.[is]
|
||||||
|
src/stub/tmp*/mipsel.r3000-*.[is]
|
||||||
|
src/stub/src/**/tmp*/*
|
||||||
|
|
||||||
|
src/stub/tools/armpe/armpe_tester.exe
|
||||||
|
src/stub/tools/armpe/armpe_tester.out
|
||||||
|
|
||||||
|
src/stub/tools/sstrip/amd64-linux-sstrip
|
||||||
|
src/stub/tools/sstrip/i386-linux-sstrip
|
||||||
|
src/stub/tools/sstrip/sstrip
|
||||||
|
|||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
[submodule "vendor/doctest"]
|
||||||
|
path = vendor/doctest
|
||||||
|
url = https://github.com/upx/upx-vendor-doctest.git
|
||||||
|
branch = upx-vendor
|
||||||
|
shallow = true
|
||||||
|
[submodule "vendor/lzma-sdk"]
|
||||||
|
path = vendor/lzma-sdk
|
||||||
|
url = https://github.com/upx/upx-vendor-lzma-sdk.git
|
||||||
|
branch = upx-vendor
|
||||||
|
shallow = true
|
||||||
|
[submodule "vendor/ucl"]
|
||||||
|
path = vendor/ucl
|
||||||
|
url = https://github.com/upx/upx-vendor-ucl.git
|
||||||
|
branch = upx-vendor
|
||||||
|
shallow = true
|
||||||
|
[submodule "vendor/zlib"]
|
||||||
|
path = vendor/zlib
|
||||||
|
url = https://github.com/upx/upx-vendor-zlib.git
|
||||||
|
branch = upx-vendor
|
||||||
|
shallow = true
|
||||||
+234
@@ -0,0 +1,234 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
|
||||||
|
|
||||||
|
# config options
|
||||||
|
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info.")
|
||||||
|
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options.")
|
||||||
|
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option.")
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# init
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
# Disallow in-source builds. Note that you will still have to manually
|
||||||
|
# clean up a few files if you accidentally try an in-source build.
|
||||||
|
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
||||||
|
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
if(",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_BINARY_DIR},")
|
||||||
|
message(FATAL_ERROR "ERROR: In-source builds are not allowed, please use an extra build dir.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# determine git revision
|
||||||
|
set(GITREV_SHORT "")
|
||||||
|
set(GITREV_PLUS "")
|
||||||
|
find_package(Git)
|
||||||
|
if(GIT_FOUND AND NOT UPX_CONFIG_DISABLE_GITREV)
|
||||||
|
execute_process(
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
|
||||||
|
ERROR_QUIET
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
OUTPUT_VARIABLE GITREV_SHORT
|
||||||
|
)
|
||||||
|
string(LENGTH "${GITREV_SHORT}" l)
|
||||||
|
if(${result} EQUAL 0 AND ${l} EQUAL 12)
|
||||||
|
execute_process(RESULT_VARIABLE result COMMAND "${GIT_EXECUTABLE}" diff --quiet)
|
||||||
|
if(NOT ${result} EQUAL 0)
|
||||||
|
set(GITREV_PLUS "+")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(GITREV_SHORT "")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git") # extra check
|
||||||
|
set(GITREV_SHORT "")
|
||||||
|
endif()
|
||||||
|
if(GITREV_SHORT)
|
||||||
|
message(STATUS "UPX_VERSION_GITREV = \"${GITREV_SHORT}${GITREV_PLUS}\"")
|
||||||
|
else()
|
||||||
|
message(STATUS "UPX_VERSION_GITREV: not set")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project(upx VERSION 4.0.0 LANGUAGES C CXX)
|
||||||
|
|
||||||
|
# set default build type to "Release"
|
||||||
|
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
|
if(is_multi_config)
|
||||||
|
set(c "${CMAKE_CONFIGURATION_TYPES}")
|
||||||
|
list(INSERT c 0 "Release")
|
||||||
|
list(INSERT c 1 "Debug")
|
||||||
|
if (CMAKE_BUILD_TYPE)
|
||||||
|
list(INSERT c 0 "${CMAKE_BUILD_TYPE}")
|
||||||
|
endif()
|
||||||
|
list(REMOVE_DUPLICATES c)
|
||||||
|
set(CMAKE_CONFIGURATION_TYPES "${c}" CACHE STRING "List of supported configuration types." FORCE)
|
||||||
|
elseif(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# targets and compilation flags
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
file(GLOB ucl_SOURCES "vendor/ucl/src/*.c")
|
||||||
|
list(SORT ucl_SOURCES)
|
||||||
|
add_library(upx_vendor_ucl STATIC ${ucl_SOURCES})
|
||||||
|
set_property(TARGET upx_vendor_ucl PROPERTY C_STANDARD 11)
|
||||||
|
|
||||||
|
file(GLOB zlib_SOURCES "vendor/zlib/*.c")
|
||||||
|
list(SORT zlib_SOURCES)
|
||||||
|
add_library(upx_vendor_zlib STATIC ${zlib_SOURCES})
|
||||||
|
set_property(TARGET upx_vendor_zlib PROPERTY C_STANDARD 11)
|
||||||
|
|
||||||
|
file(GLOB upx_SOURCES "src/*.cpp" "src/util/*.cpp")
|
||||||
|
list(SORT upx_SOURCES)
|
||||||
|
add_executable(upx ${upx_SOURCES})
|
||||||
|
set_property(TARGET upx PROPERTY CXX_STANDARD 14)
|
||||||
|
target_link_libraries(upx upx_vendor_ucl upx_vendor_zlib)
|
||||||
|
|
||||||
|
if(UPX_CONFIG_DISABLE_WERROR)
|
||||||
|
set(warn_Werror "")
|
||||||
|
set(warn_WX "")
|
||||||
|
else()
|
||||||
|
set(warn_Werror -Werror)
|
||||||
|
set(warn_WX -WX)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT MSVC)
|
||||||
|
# use -O2 instead of -O3 to reduce code size
|
||||||
|
string(REGEX REPLACE "(^| )-O3( |$$)" "\\1-O2\\2" a "${CMAKE_C_FLAGS_RELEASE}")
|
||||||
|
string(REGEX REPLACE "(^| )-O3( |$$)" "\\1-O2\\2" b "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${a}" CACHE STRING "Flags used by the C compiler during RELEASE builds." FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${b}" CACHE STRING "Flags used by the CXX compiler during RELEASE builds." FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# disable silly warnings about using "deprecated" POSIX functions like fopen()
|
||||||
|
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
|
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
else()
|
||||||
|
# protect against security threats caused by misguided compiler "optimizations"
|
||||||
|
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||||
|
add_definitions(-fno-delete-null-pointer-checks)
|
||||||
|
endif()
|
||||||
|
add_definitions(-fno-strict-aliasing -fno-strict-overflow -funsigned-char)
|
||||||
|
# disable overambitious auto-vectorization until this actually gains something
|
||||||
|
add_definitions(-fno-tree-vectorize)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(t upx_vendor_ucl)
|
||||||
|
target_include_directories(${t} PRIVATE vendor/ucl/include vendor/ucl)
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${t} PRIVATE -J -W4 ${warn_WX})
|
||||||
|
else()
|
||||||
|
target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla ${warn_Werror})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(t upx_vendor_zlib)
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${t} PRIVATE -DHAVE_STDARG_H -DHAVE_VSNPRINTF -J -W3 ${warn_WX})
|
||||||
|
else()
|
||||||
|
target_compile_options(${t} PRIVATE -DHAVE_STDARG_H -DHAVE_UNISTD_H -DHAVE_VSNPRINTF)
|
||||||
|
# clang-15: -Wno-strict-prototypes is needed to silence the new -Wdeprecated-non-prototype warning
|
||||||
|
target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla -Wno-strict-prototypes ${warn_Werror})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(t upx)
|
||||||
|
target_include_directories(${t} PRIVATE vendor)
|
||||||
|
target_compile_definitions(${t} PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
|
||||||
|
if(GITREV_SHORT)
|
||||||
|
target_compile_definitions(${t} PRIVATE UPX_VERSION_GITREV="${GITREV_SHORT}${GITREV_PLUS}")
|
||||||
|
endif()
|
||||||
|
if(NOT UPX_CONFIG_DISABLE_SANITIZE AND NOT MSVC)
|
||||||
|
# default sanitizer for Debug builds
|
||||||
|
target_compile_options(${t} PRIVATE $<$<CONFIG:Debug>:-fsanitize=undefined -fsanitize-undefined-trap-on-error -fstack-protector-all>)
|
||||||
|
# default sanitizer for Release builds
|
||||||
|
target_compile_options(${t} PRIVATE $<$<CONFIG:Release>:-fstack-protector>)
|
||||||
|
endif()
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${t} PRIVATE -EHsc -J -W4 ${warn_WX})
|
||||||
|
else()
|
||||||
|
target_compile_options(${t} PRIVATE
|
||||||
|
-Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith
|
||||||
|
-Wshadow -Wvla -Wwrite-strings ${warn_Werror}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# "make test"
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
|
include(CTest)
|
||||||
|
set(exe ${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
|
set(upx_self_exe "$<TARGET_FILE:upx>")
|
||||||
|
add_test(NAME upx-test-cleanup COMMAND rm -f ./upx.packed${exe} ./upx.unpacked${exe})
|
||||||
|
add_test(NAME upx-version COMMAND upx --version)
|
||||||
|
add_test(NAME upx-help COMMAND upx --help)
|
||||||
|
add_test(NAME upx-self-pack COMMAND upx -3 ${upx_self_exe} -o upx.packed${exe})
|
||||||
|
add_test(NAME upx-list COMMAND upx -l upx.packed${exe})
|
||||||
|
add_test(NAME upx-fileinfo COMMAND upx --fileinfo upx.packed${exe})
|
||||||
|
add_test(NAME upx-test COMMAND upx -t upx.packed${exe})
|
||||||
|
add_test(NAME upx-unpack COMMAND upx -d upx.packed${exe} -o upx.unpacked${exe})
|
||||||
|
add_test(NAME upx-run-unpacked COMMAND ./upx.unpacked${exe} --version)
|
||||||
|
add_test(NAME upx-run-packed COMMAND ./upx.packed${exe} --version)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO: could add some more explicit test programs; but then, the integrated
|
||||||
|
# "doctest" is quite convenient and already covers a number of basic
|
||||||
|
# checks - and more complex cases better should be handled by an
|
||||||
|
# external test suite.
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# "make install"
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
# installation prefix and directories
|
||||||
|
if(NOT CMAKE_INSTALL_PREFIX)
|
||||||
|
message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.")
|
||||||
|
endif()
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
if(DEFINED CMAKE_INSTALL_FULL_BINDIR)
|
||||||
|
install(TARGETS upx DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
|
||||||
|
install(FILES
|
||||||
|
COPYING LICENSE NEWS README doc/upx-doc.html doc/upx-doc.txt
|
||||||
|
DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}"
|
||||||
|
)
|
||||||
|
install(FILES doc/upx.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# finally print some info about the build configuration
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/maint/src/CMakeLists.extra.txt")
|
||||||
|
include("${CMAKE_CURRENT_SOURCE_DIR}/maint/src/CMakeLists.extra.txt")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
function(print_var v)
|
||||||
|
if(${v})
|
||||||
|
message(STATUS "${v} = ${${v}}")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
print_var(CMAKE_BUILD_TYPE)
|
||||||
|
print_var(CMAKE_CONFIGURATION_TYPES)
|
||||||
|
print_var(CMAKE_INSTALL_PREFIX)
|
||||||
|
print_var(CMAKE_CROSSCOMPILING)
|
||||||
|
print_var(CMAKE_C_COMPILER_ID)
|
||||||
|
print_var(CMAKE_C_COMPILER_VERSION)
|
||||||
|
print_var(CMAKE_C_COMPILER_ARCHITECTURE_ID)
|
||||||
|
print_var(CMAKE_C_PLATFORM_ID)
|
||||||
|
print_var(CMAKE_C_COMPILER_ABI)
|
||||||
|
print_var(CMAKE_CXX_COMPILER_ID)
|
||||||
|
print_var(CMAKE_CXX_COMPILER_VERSION)
|
||||||
|
print_var(CMAKE_CXX_COMPILER_ARCHITECTURE_ID)
|
||||||
|
print_var(CMAKE_CXX_PLATFORM_ID)
|
||||||
|
print_var(CMAKE_CXX_COMPILER_ABI)
|
||||||
|
if (CMAKE_BUILD_TYPE AND NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release)$")
|
||||||
|
message(WARNING "WARNING: unsupported CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}; please use \"Debug\" or \"Release\"")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
|
|||||||
General Public License applies to most of the Free Software
|
General Public License applies to most of the Free Software
|
||||||
Foundation's software and to any other program whose authors commit to
|
Foundation's software and to any other program whose authors commit to
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
the GNU Library General Public License instead.) You can apply it to
|
the GNU Lesser General Public License instead.) You can apply it to
|
||||||
your programs, too.
|
your programs, too.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
@@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
|||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
|
|||||||
License. (Exception: if the Program itself is interactive but
|
License. (Exception: if the Program itself is interactive but
|
||||||
does not normally print such an announcement, your work based on
|
does not normally print such an announcement, your work based on
|
||||||
the Program is not required to print an announcement.)
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
These requirements apply to the modified work as a whole. If
|
||||||
identifiable sections of that work are not derived from the Program,
|
identifiable sections of that work are not derived from the Program,
|
||||||
and can be reasonably considered independent and separate works in
|
and can be reasonably considered independent and separate works in
|
||||||
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
|
|||||||
access to copy the source code from the same place counts as
|
access to copy the source code from the same place counts as
|
||||||
distribution of the source code, even though third parties are not
|
distribution of the source code, even though third parties are not
|
||||||
compelled to copy the source along with the object code.
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
except as expressly provided under this License. Any attempt
|
except as expressly provided under this License. Any attempt
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
@@ -225,7 +225,7 @@ impose that choice.
|
|||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
This section is intended to make thoroughly clear what is believed to
|
||||||
be a consequence of the rest of this License.
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
original copyright holder who places the Program under this License
|
original copyright holder who places the Program under this License
|
||||||
@@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|||||||
POSSIBILITY OF SUCH DAMAGES.
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
|
|||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) 19yy <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License along
|
||||||
along with this program; if not, write to the Free Software
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
If the program is interactive, make it output a short notice like this
|
||||||
when it starts in an interactive mode:
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
@@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
|
|||||||
This General Public License does not permit incorporating your program into
|
This General Public License does not permit incorporating your program into
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
consider it more useful to permit linking proprietary applications with the
|
consider it more useful to permit linking proprietary applications with the
|
||||||
library. If this is what you want to do, use the GNU Library General
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License.
|
Public License instead of this License.
|
||||||
|
|||||||
@@ -1,43 +1,85 @@
|
|||||||
# Toplevel Makefile for UPX
|
#
|
||||||
|
# UPX top-level Makefile - needs GNU make and CMake >= 3.13
|
||||||
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
# NOTE: if you only have CMake 3.10 then you can invoke cmake manually like this:
|
||||||
.SUFFIXES:
|
# mkdir -p build/release
|
||||||
export SHELL = /bin/sh
|
# cd build/release
|
||||||
|
# cmake ../..
|
||||||
|
# cmake --build .
|
||||||
|
|
||||||
srcdir = .
|
CMAKE = cmake
|
||||||
top_srcdir = .
|
UPX_CMAKE_BUILD_FLAGS += --parallel
|
||||||
|
ifneq ($(VERBOSE),)
|
||||||
|
UPX_CMAKE_BUILD_FLAGS += --verbose
|
||||||
default:
|
|
||||||
@echo "UPX info: please choose a target for 'make'"
|
|
||||||
|
|
||||||
all mostlyclean clean distclean maintainer-clean:
|
|
||||||
$(MAKE) -C src/stub/util/sstrip $@
|
|
||||||
$(MAKE) -C src/stub $@
|
|
||||||
$(MAKE) -C src $@
|
|
||||||
$(MAKE) -C doc $@
|
|
||||||
|
|
||||||
dist: distclean
|
|
||||||
false
|
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(wildcard CVS/R*),)
|
|
||||||
CVS_ROOT := $(shell cat CVS/Root)
|
|
||||||
CVS_REPO := $(shell cat CVS/Repository)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cvs-info:
|
# check git submodules
|
||||||
@echo 'CVS info: $(CVS_ROOT) $(CVS_REPO)'
|
ifeq ($(wildcard ./vendor/doctest/doctest/.),)
|
||||||
|
$(error ERROR: missing git submodule; run 'git submodule update --init')
|
||||||
|
endif
|
||||||
|
ifeq ($(wildcard ./vendor/lzma-sdk/C/.),)
|
||||||
|
$(error ERROR: missing git submodule; run 'git submodule update --init')
|
||||||
|
endif
|
||||||
|
ifeq ($(wildcard ./vendor/ucl/include/.),)
|
||||||
|
$(error ERROR: missing git submodule; run 'git submodule update --init')
|
||||||
|
endif
|
||||||
|
ifeq ($(wildcard ./vendor/zlib/crc32.c),)
|
||||||
|
$(error ERROR: missing git submodule; run 'git submodule update --init')
|
||||||
|
endif
|
||||||
|
|
||||||
cvs-admin-ko:
|
#***********************************************************************
|
||||||
cvs admin -ko .
|
# default
|
||||||
cvs -q -z6 update -P -d
|
#***********************************************************************
|
||||||
|
|
||||||
# automatically generate ChangeLog from CVS
|
__check_cache = $(if $(wildcard $1/CMakeCache.txt),@true,)
|
||||||
ChangeLog ChangeLog.cvs:
|
run_config = $(call __check_cache,$1) $(CMAKE) -S . -B $1 $(UPX_CMAKE_CONFIG_FLAGS) -DCMAKE_BUILD_TYPE=$2
|
||||||
perl $(srcdir)/scripts/cvs2cl.pl --utc -f ChangeLog.cvs
|
run_build = $(CMAKE) --build $1 $(UPX_CMAKE_BUILD_FLAGS) --config $2
|
||||||
|
|
||||||
|
default: build/release
|
||||||
|
|
||||||
.PHONY: all mostlyclean clean distclean maintainer-clean
|
build/debug: PHONY
|
||||||
.PHONY: dist cvs-info cvs-admin-ko ChangeLog ChangeLog.cvs
|
$(call run_config,$@,Debug)
|
||||||
|
$(call run_build,$@,Debug)
|
||||||
|
|
||||||
|
build/release: PHONY
|
||||||
|
$(call run_config,$@,Release)
|
||||||
|
$(call run_build,$@,Release)
|
||||||
|
|
||||||
|
#***********************************************************************
|
||||||
|
# some pre-defined build configurations
|
||||||
|
#***********************************************************************
|
||||||
|
|
||||||
|
# force building with gcc/g++
|
||||||
|
build/%-gcc: export CC=gcc
|
||||||
|
build/%-gcc: export CXX=g++
|
||||||
|
build/debug-gcc: PHONY
|
||||||
|
$(call run_config,$@,Debug)
|
||||||
|
$(call run_build,$@,Debug)
|
||||||
|
build/release-gcc: PHONY
|
||||||
|
$(call run_config,$@,Release)
|
||||||
|
$(call run_build,$@,Release)
|
||||||
|
|
||||||
|
# force building with clang/clang++
|
||||||
|
build/%-clang: export CC=clang
|
||||||
|
build/%-clang: export CXX=clang++
|
||||||
|
build/debug-clang: PHONY
|
||||||
|
$(call run_config,$@,Debug)
|
||||||
|
$(call run_build,$@,Debug)
|
||||||
|
build/release-clang: PHONY
|
||||||
|
$(call run_config,$@,Release)
|
||||||
|
$(call run_build,$@,Release)
|
||||||
|
|
||||||
|
# cross compiler: Windows mingw-w64
|
||||||
|
build/%-cross-mingw64: export CC=x86_64-w64-mingw32-gcc
|
||||||
|
build/%-cross-mingw64: export CXX=x86_64-w64-mingw32-g++
|
||||||
|
# disable sanitize to avoid link errors on GitHub CI
|
||||||
|
build/%-cross-mingw64: UPX_CMAKE_CONFIG_FLAGS += -DUPX_CONFIG_DISABLE_SANITIZE=1
|
||||||
|
build/debug-cross-mingw64: PHONY
|
||||||
|
$(call run_config,$@,Debug)
|
||||||
|
$(call run_build,$@,Debug)
|
||||||
|
build/release-cross-mingw64: PHONY
|
||||||
|
$(call run_config,$@,Release)
|
||||||
|
$(call run_build,$@,Release)
|
||||||
|
|
||||||
|
.PHONY: default PHONY
|
||||||
|
|||||||
@@ -2,6 +2,179 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 3.99 (27 Oct 2022):
|
||||||
|
* NOTE: this is a pre-release with known regressions for some ELF formats;
|
||||||
|
please help testing and reporting bugs, and see our GitHub Actions CI
|
||||||
|
page for up-to-date pre-built binaries ("Artifacts")
|
||||||
|
https://github.com/upx/upx/actions/workflows/ci.yml
|
||||||
|
* SECURITY NOTES: emphasize the security context in the docs
|
||||||
|
* Support easy building from source code with CMake
|
||||||
|
* Add support for EFI files (PE x86; Kornel Pal)
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/6
|
||||||
|
|
||||||
|
Changes in 3.96 (23 Jan 2020):
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/5
|
||||||
|
|
||||||
|
Changes in 3.95 (26 Aug 2018):
|
||||||
|
* Flag --android-shlib to work around bad design in Android
|
||||||
|
* Flag --force-pie when ET_DYN main program is not marked as DF_1_PIE
|
||||||
|
* Better compatibility with varying layout of address space on Linux
|
||||||
|
* Support for 4 PT_LOAD layout in ELF generated by binutils-2.31
|
||||||
|
* bug fixes, particularly better diagnosis of malformed input
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/4
|
||||||
|
|
||||||
|
Changes in 3.94 (12 May 2017):
|
||||||
|
* Add support for arm64-linux (aka "aarch64").
|
||||||
|
* Add support for --lzma compression on 64-bit PowerPC (Thierry Fauck).
|
||||||
|
* For Mach, "upx -d" will unpack a prefix of the file (and warn).
|
||||||
|
* Various improvements to the ELF formats.
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/3
|
||||||
|
|
||||||
|
Changes in 3.93 (29 Jan 2017):
|
||||||
|
* Fixed some win32/pe and win64/pe regressions introduced in 3.92
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/2
|
||||||
|
|
||||||
|
Changes in 3.92 (11 Dec 2016):
|
||||||
|
* INFO: UPX has moved to GitHub - the new home page is https://upx.github.io
|
||||||
|
* IMPORTANT: all PE formats: internal changes: reunited the diverged source
|
||||||
|
files - please report all regressions into the bug tracker and try UPX 3.91
|
||||||
|
in case of problems.
|
||||||
|
* Support Apple MacOS 10.12 "Sierra", including more-robust de-compression.
|
||||||
|
* Explicitly diagnose Go-language bad PT_LOAD; recommend hemfix.c.
|
||||||
|
https://sourceforge.net/p/upx/bugs/195/ https://github.com/pwaller/goupx
|
||||||
|
* Fix CERT-FI Case 829767 UPX command line tools segfaults.
|
||||||
|
Received by UPX Team on 2015-May-08; originally reported
|
||||||
|
by Codenomicon to NCSC-FI on 2015-01-08.
|
||||||
|
The vulnerabilities were discovered by Joonas Kuorilehto and
|
||||||
|
Antti Häyrynen from Codenomicon.
|
||||||
|
* bug fixes - see https://github.com/upx/upx/milestone/1
|
||||||
|
|
||||||
|
Changes in 3.91 (30 Sep 2013):
|
||||||
|
* Added experimental support for Windows 64-bit PE files, based on
|
||||||
|
work by Stefan Widmann. Please use for testing only!
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 3.09 (18 Feb 2013):
|
||||||
|
* New option --preserve-build-id for GNU ELF.
|
||||||
|
* Allow for code signing and LC_UUID on Mac OS X executables.
|
||||||
|
* Allow non-contiguous LC_SEGMENTs and 0==.vmsize for Mach-O.
|
||||||
|
* Allow zero-filled final page in PackUnix::canUnpack().
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.08 (12 Dec 2011):
|
||||||
|
* Fix allocation in runtime stub for darwin.macho-entry (i386 and amd64).
|
||||||
|
* Compress shared library on ELF i386 only [ld.so threatens even this case].
|
||||||
|
* Attempt to support ELF on QNX 6.3.0 for armel (experimental).
|
||||||
|
* Better diagnostic when ELF -fPIC is needed.
|
||||||
|
* PT_NOTE improvements for *BSD.
|
||||||
|
* Preserve more ELF .e_flags on ARM.
|
||||||
|
* Minor code improvements for ELF stubs.
|
||||||
|
* Defend against another flavor of corrupt PE header.
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.07 (08 Sep 2010):
|
||||||
|
* win32/pe: fixed relocation handling for files with *no* TLS callbacks
|
||||||
|
[severe bug introduced in 3.06]
|
||||||
|
|
||||||
|
Changes in 3.06 (04 Sep 2010):
|
||||||
|
* win32/pe: TLS callback support contributed by Stefan Widmann. Thanks!
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.05 (27 Apr 2010):
|
||||||
|
* i386-linux and amd64-linux support shared libraries (DT_INIT must
|
||||||
|
exist, all info needed by runtime loader must be first in .text, etc.)
|
||||||
|
* Linux /proc/self/exe now is preserved by default, by leaving behind
|
||||||
|
one page. New compress-time option --unmap-all-pages is available.
|
||||||
|
* Withdraw support for shared libraries on Darwin (Apple Mac OS X)
|
||||||
|
because upx does not understand enough about .dylib.
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.04 (27 Sep 2009):
|
||||||
|
* new format Mach/AMD64 supports 64-bit programs on Apple Macintosh.
|
||||||
|
* new formats Dylib/i386 and Dylib/ppc32 support shared libraries
|
||||||
|
[such as browser plugins] on Darwin (Apple Macintosh). An existing
|
||||||
|
-init function (LC_ROUTINES command) is required.
|
||||||
|
* new format vmlinuz/armel for Debian NSLU2 (etc.) linux kernel
|
||||||
|
* bvmlinuz boot protocol 2.08 for 386 Linux kernel
|
||||||
|
* Extended ABI version 4 for armel-eabi ARM Linux ELF
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.03 (27 Apr 2008):
|
||||||
|
* implement cache flushing for PowerPC (esp. model 440)
|
||||||
|
* fix cache flushing on MIPS (>3 MiB compressed, or with holes)
|
||||||
|
* fix MIPS big-endian
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.02 (16 Dec 2007):
|
||||||
|
* fix unmapping on arm-linux.elf
|
||||||
|
* fix error checking in mmap for i386-linux.elf [triggered by -fPIE]
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.01 (31 Jul 2007):
|
||||||
|
* new options --no-mode, --no-owner and --no-time to disable preservation
|
||||||
|
of mode (file permissions), file ownership and timestamps.
|
||||||
|
* dos/exe: fixed an incorrect error message caused by a bug in
|
||||||
|
relocation handling
|
||||||
|
* new format linux/mipsel supports ELF on [32-bit] R3000
|
||||||
|
* fix argv[0] on PowerPC with --lzma
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.00 (27 Apr 2007):
|
||||||
|
* watcom/le & tmt/adam: fixed a problem when using certain filters
|
||||||
|
|
||||||
|
Changes in 2.93 beta (08 Mar 2007):
|
||||||
|
* new formats Mach/i386 and Mach/fat support Mac OS X i686 and
|
||||||
|
Universal binaries [i686 and PowerPC only]
|
||||||
|
* dos/exe: LZMA is now also supported for 16-bit dos/exe. Please note that
|
||||||
|
you have to explicitly use '--lzma' even for '--ultra-brute' here
|
||||||
|
because runtime decompression is about 30 times slower than NRV -
|
||||||
|
which is really noticeable on old machines.
|
||||||
|
* dos/exe: fixed a rarely occurring bug in relocation handling
|
||||||
|
* win32/pe & arm/pe: better icon compression handling
|
||||||
|
|
||||||
|
Changes in 2.92 beta (23 Jan 2007):
|
||||||
|
* new option '--ultra-brute' which tries even more variants
|
||||||
|
* slightly improved compression ratio for some files when
|
||||||
|
using '--brute' or '--ultra-brute'
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 2.91 beta (29 Nov 2006):
|
||||||
|
* assorted bug fixes
|
||||||
|
* arm/pe: fix "missing" icon & version info resource problem for wince 5
|
||||||
|
* win32/pe & arm/pe: added option --compress-icons=3 to compress all icons
|
||||||
|
|
||||||
|
Changes in 2.90 beta (08 Oct 2006):
|
||||||
|
* LZMA algorithm support for most of the 32-bit and 64-bit file formats;
|
||||||
|
use new option '--lzma' to enable
|
||||||
|
* new format: BSD/elf386 supporting FreeBSD, NetBSD and OpenBSD
|
||||||
|
via auto-detection of PT_NOTE or EI_OSABI
|
||||||
|
* arm/pe: all the NRV compression methods are now supported
|
||||||
|
(only NRV2D is missing in thumb mode)
|
||||||
|
* linux/elf386, linux/ElfAMD: remember /proc/self/exe in environment
|
||||||
|
* major source code changes: the runtime decompression stubs are now
|
||||||
|
built from internal ELF objects
|
||||||
|
|
||||||
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 2.03 (07 Nov 2006):
|
||||||
|
* bvmlinuz/386: fix for kernels not at 0x100000; also allow x86_64
|
||||||
|
* linux/elf386: work around Linux kernel bug (0-length .bss needs PF_W)
|
||||||
|
|
||||||
|
Changes in 2.02 (13 Aug 2006):
|
||||||
|
* linux/386: work around Linux kernel bug (".bss" requires PF_W)
|
||||||
|
* linux/ppc32, mach/ppc32: compressed programs now work on a 405 CPU
|
||||||
|
* vmlinuz/386: fixed zlib uncompression problem on DOS
|
||||||
|
|
||||||
|
Changes in 2.01 (06 Jun 2006):
|
||||||
|
* arm/pe: better DLL support
|
||||||
|
* dos/exe: device driver support added
|
||||||
|
* linux/386: Fix --force-execve for PaX, grSecurity, and strict SELinux.
|
||||||
|
/tmp must support execve(); therefore /tmp cannot be mounted 'noexec'.
|
||||||
|
* win32/pe & arm/pe: added new option '--keep-resource=' for
|
||||||
|
excluding selected resources from compression
|
||||||
|
|
||||||
Changes in 2.00 (27 Apr 2006):
|
Changes in 2.00 (27 Apr 2006):
|
||||||
* linux/386: the stub now prints an error message if some strict
|
* linux/386: the stub now prints an error message if some strict
|
||||||
SELinux mode does prevent runtime decompression and execution
|
SELinux mode does prevent runtime decompression and execution
|
||||||
@@ -261,8 +434,8 @@ Changes in 0.80 (03 Aug 1999)
|
|||||||
* win32/pe: even better TLS support
|
* win32/pe: even better TLS support
|
||||||
* win32/pe: versioninfo works on NT
|
* win32/pe: versioninfo works on NT
|
||||||
* win32/pe: import by ordinal from kernel32.dll works
|
* win32/pe: import by ordinal from kernel32.dll works
|
||||||
* win32/pe: other import improvements: importing a nonexistant DLL
|
* win32/pe: other import improvements: importing a nonexistent DLL
|
||||||
results in a usual Windows message, importing a nonexistant function
|
results in a usual Windows message, importing a nonexistent function
|
||||||
results in program exit (instead of crash ;-)
|
results in program exit (instead of crash ;-)
|
||||||
* win32/pe: new option: '--compress-resources=0'
|
* win32/pe: new option: '--compress-resources=0'
|
||||||
* win32/pe: reduced memory requirement during uncompression, some
|
* win32/pe: reduced memory requirement during uncompression, some
|
||||||
@@ -314,7 +487,7 @@ Changes in 0.60 (06 Mar 1999)
|
|||||||
* win32/pe: fixed file corruption when the size of the export data is invalid
|
* win32/pe: fixed file corruption when the size of the export data is invalid
|
||||||
* win32/pe: fixed a problem with empty resource data
|
* win32/pe: fixed a problem with empty resource data
|
||||||
* win32/pe: compressed file alignment set to minimum value
|
* win32/pe: compressed file alignment set to minimum value
|
||||||
* win32/pe: made all compressed sections writeable
|
* win32/pe: made all compressed sections writable
|
||||||
* fixed some other win32/pe bugs
|
* fixed some other win32/pe bugs
|
||||||
* fixed an address optimization problem for some not Watcom LE files
|
* fixed an address optimization problem for some not Watcom LE files
|
||||||
* fixed a bug which could make UPX hang when an exe header contained
|
* fixed a bug which could make UPX hang when an exe header contained
|
||||||
@@ -355,3 +528,5 @@ Changes in 0.20 (05 Jul 1998)
|
|||||||
Changes in 0.05 (26 May 1998)
|
Changes in 0.05 (26 May 1998)
|
||||||
* first public beta release
|
* first public beta release
|
||||||
|
|
||||||
|
|
||||||
|
# vim:set syntax=off tw=0 ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||||
|
|||||||
@@ -1,91 +0,0 @@
|
|||||||
ooooo ooo ooooooooo. ooooooo ooooo
|
|
||||||
`888' `8' `888 `Y88. `8888 d8'
|
|
||||||
888 8 888 .d88' Y888..8P
|
|
||||||
888 8 888ooo88P' `8888'
|
|
||||||
888 8 888 .8PY888.
|
|
||||||
`88. .8' 888 d8' `888b
|
|
||||||
`YbodP' o888o o888o o88888o
|
|
||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
|
||||||
http://upx.sourceforge.net
|
|
||||||
|
|
||||||
|
|
||||||
Here are some possible projects from which you can choose if you'd like to
|
|
||||||
contribute to UPX. Be sure to get in touch with us first to avoid
|
|
||||||
duplicate efforts.
|
|
||||||
|
|
||||||
|
|
||||||
User interface:
|
|
||||||
---------------
|
|
||||||
|
|
||||||
- Write a nifty Win32 GUI (in C++), but try to keep the size of the
|
|
||||||
final executable small. Compression should be in a separate
|
|
||||||
thread that calls do_one_file() [see src/work.cpp].
|
|
||||||
|
|
||||||
- Draw a nice UPX icon.
|
|
||||||
|
|
||||||
|
|
||||||
More formats:
|
|
||||||
-------------
|
|
||||||
|
|
||||||
- Amiga
|
|
||||||
|
|
||||||
- BeOS
|
|
||||||
|
|
||||||
- C64
|
|
||||||
|
|
||||||
- elks/8086 (this is a 16-bit linux-8086 kernel)
|
|
||||||
See http://www.elks.ecs.soton.ac.uk/
|
|
||||||
|
|
||||||
- freebsd/386 (generic), freebsd/elf386 (specialized).
|
|
||||||
Probably could share most of the linux code.
|
|
||||||
|
|
||||||
- add support for self-extracting HTML pages using a Javascript stub
|
|
||||||
(like the AlgART HTML Packer "AHP")
|
|
||||||
|
|
||||||
|
|
||||||
Existing formats:
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
- djgpp2/coff: add support for DLX dynamic loading
|
|
||||||
(see SEAL http://www.home.sk/public/seal/ )
|
|
||||||
|
|
||||||
- dos/com: add support for very long files - convert to exe if necessary
|
|
||||||
|
|
||||||
- dos/exe: implement filter support
|
|
||||||
|
|
||||||
- dos/sys: add support for sys/exe combos
|
|
||||||
|
|
||||||
- linux/i386:
|
|
||||||
- use the new assembly preprocessor stuff (ie. process the file
|
|
||||||
headers internally)
|
|
||||||
- UPX uncompressor daemon
|
|
||||||
- rewrite the stub in assembly (not sure if this is a good idea...)
|
|
||||||
|
|
||||||
- watcom/le: add support for per section compression, LX support, VXD
|
|
||||||
|
|
||||||
- win32/pe: display a nice dialog box in the stub in case
|
|
||||||
of problems (like importing a DLL or function fails)
|
|
||||||
- win32/pe: finer control over resource compression, per section
|
|
||||||
compression
|
|
||||||
|
|
||||||
|
|
||||||
Compression ratio:
|
|
||||||
------------------
|
|
||||||
|
|
||||||
- invent more effective filters
|
|
||||||
|
|
||||||
- I (Markus) will continue to work on better compression algorithms,
|
|
||||||
so be sure to do better than me if you plan working on this ;-)
|
|
||||||
|
|
||||||
|
|
||||||
Other:
|
|
||||||
------
|
|
||||||
|
|
||||||
- anything else you think that could improve UPX...
|
|
||||||
|
|
||||||
|
|
||||||
Thanks for your contribution.
|
|
||||||
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
ooooo ooo ooooooooo. ooooooo ooooo
|
ooooo ooo ooooooooo. ooooooo ooooo
|
||||||
`888' `8' `888 `Y88. `8888 d8'
|
`888' `8' `888 `Y88. `8888 d8'
|
||||||
888 8 888 .d88' Y888..8P
|
888 8 888 .d88' Y888..8P
|
||||||
888 8 888ooo88P' `8888'
|
888 8 888ooo88P' `8888'
|
||||||
888 8 888 .8PY888.
|
888 8 888 .8PY888.
|
||||||
`88. .8' 888 d8' `888b
|
`88. .8' 888 d8' `888b
|
||||||
`YbodP' o888o o888o o88888o
|
`YbodP' o888o o888o o88888o
|
||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,10 +18,8 @@ WELCOME
|
|||||||
|
|
||||||
Welcome to UPX !
|
Welcome to UPX !
|
||||||
|
|
||||||
Please don't forget to read the file LICENSE - UPX is distributed
|
UPX is a free, secure, portable, extendable, high-performance
|
||||||
under the GNU General Public License (GPL) with special exceptions
|
executable packer for several executable formats.
|
||||||
allowing the distribution of all compressed executables, including
|
|
||||||
commercial programs.
|
|
||||||
|
|
||||||
|
|
||||||
INTRODUCTION
|
INTRODUCTION
|
||||||
@@ -37,106 +35,88 @@ and run exactly as before, with no runtime or memory penalty for most
|
|||||||
of the supported formats.
|
of the supported formats.
|
||||||
|
|
||||||
UPX supports a number of different executable formats, including
|
UPX supports a number of different executable formats, including
|
||||||
Windows 95/98/ME/NT/2000/XP/CE programs and DLLs, DOS programs,
|
Windows programs and DLLs, macOS apps and Linux executables.
|
||||||
and Linux executables and kernels.
|
|
||||||
|
|
||||||
UPX is free software distributed under the term of the GNU General
|
UPX is free software distributed under the term of the GNU General
|
||||||
Public License. Full source code is available.
|
Public License. Full source code is available.
|
||||||
|
|
||||||
UPX may be distributed and used freely, even with commercial applications.
|
UPX may be distributed and used freely, even with commercial applications.
|
||||||
See the UPX License Agreement for details.
|
See the UPX License Agreements for details.
|
||||||
|
|
||||||
UPX is rated number one in the well known Archive Comparison Test. Visit
|
|
||||||
http://compression.ca/ .
|
|
||||||
|
|
||||||
UPX aims to be Commercial Quality Freeware.
|
SECURITY CONTEXT
|
||||||
|
================
|
||||||
|
|
||||||
|
IMPORTANT NOTE: UPX inherits the security context of any files it handles.
|
||||||
|
|
||||||
|
This means that packing, unpacking, or even testing or listing a file requires
|
||||||
|
the same security considerations as actually executing the file.
|
||||||
|
|
||||||
|
Use UPX on trusted files only!
|
||||||
|
|
||||||
|
|
||||||
SHORT DOCUMENTATION
|
SHORT DOCUMENTATION
|
||||||
===================
|
===================
|
||||||
|
|
||||||
'upx program.exe' will compress a program or DLL. For best compression
|
'upx program.exe' will compress a program or DLL. For best compression
|
||||||
results try 'upx --brute program.exe'.
|
results try 'upx --best program.exe' or 'upx --brute program.exe'.
|
||||||
|
|
||||||
Please see the file UPX.DOC for the full documentation. The files
|
Please see the file UPX.DOC for the full documentation. The files
|
||||||
NEWS and BUGS also contain various tidbits of information.
|
NEWS and BUGS also contain various tidbits of information.
|
||||||
|
|
||||||
|
|
||||||
DISCLAIMER
|
|
||||||
==========
|
|
||||||
|
|
||||||
UPX comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
|
|
||||||
|
|
||||||
Having said that, we think that UPX is quite stable now. Indeed we
|
|
||||||
have compressed lots of files without any problems. Also, the
|
|
||||||
current version has undergone several months of beta testing -
|
|
||||||
actually it's almost 8 years since our first public beta.
|
|
||||||
|
|
||||||
This is the first production quality release, and we plan that future
|
|
||||||
releases will be backward compatible with this version.
|
|
||||||
|
|
||||||
Please report all problems or suggestions to the authors. Thanks.
|
|
||||||
|
|
||||||
|
|
||||||
THE FUTURE
|
THE FUTURE
|
||||||
==========
|
==========
|
||||||
|
|
||||||
- We'd really love to support handheld systems like the PalmPilot because
|
- Stay up-to-date with ongoing OS and executable format changes.
|
||||||
compression makes a lot of sense here. And - because of the atari/tos
|
|
||||||
format - we already have a working decompressor in 68000 assembly.
|
|
||||||
Unfortunately we know next to nothing about the operating system
|
|
||||||
architecture of such handhelds, so we need some information from
|
|
||||||
an expert. Please contact us if you think you can help.
|
|
||||||
|
|
||||||
- The Linux approach could probably get ported to a lot of other Unix
|
- RISC-V 64 for Linux.
|
||||||
variants, at least for other i386 architectures it shouldn't be too
|
|
||||||
much work. If someone sends me a fresh hard disk and an official
|
|
||||||
FreeBSD/OpenBSD/NetBSD/Solaris/BeOS... CD I might take a look at it ;-)
|
|
||||||
|
|
||||||
- We will *NOT* add any sort of protection and/or encryption.
|
- We will *NOT* add any sort of protection and/or encryption.
|
||||||
This only gives people a false feeling of security because
|
This only gives people a false feeling of security because
|
||||||
by definition all protectors/compressors can be broken.
|
all "protectors" can be broken by definition.
|
||||||
And don't trust any advertisment of authors of other executable
|
|
||||||
compressors about this topic - just do a websearch on "unpackers"...
|
|
||||||
|
|
||||||
- Fix all remaining bugs - keep your reports coming ;-)
|
- Fix all remaining bugs - please report any issues
|
||||||
|
https://github.com/upx/upx/issues
|
||||||
- See the file PROJECTS in the source code distribution if you want
|
|
||||||
to contribute.
|
|
||||||
|
|
||||||
|
|
||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2006 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
Copyright (C) 2000-2006 John F. Reiser
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
UPX License Agreement for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the UPX License Agreement along
|
UPX is distributed with full source code under the terms of the
|
||||||
with this program; see the file LICENSE. If not, visit the UPX home page.
|
GNU General Public License v2+;
|
||||||
|
either under the pure GPLv2+ (see the file COPYING),
|
||||||
|
or (at your option) under the GPLv+2 with special exceptions and
|
||||||
|
restrictions granting the free usage for commercial
|
||||||
|
programs (see the file LICENSE).
|
||||||
|
|
||||||
|
You should have received a copy of the UPX License Agreements along
|
||||||
|
with this program; see the files COPYING and LICENSE. If not,
|
||||||
|
visit the UPX home page.
|
||||||
|
|
||||||
|
|
||||||
Share and enjoy,
|
Share and enjoy,
|
||||||
Markus & Laszlo
|
Markus & Laszlo & John
|
||||||
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
|
John F. Reiser
|
||||||
|
<jreiser@BitWagon.com>
|
||||||
|
|
||||||
|
|
||||||
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
|
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
|
||||||
and holds no connection with potential owners of registered trademarks
|
and holds no connection with potential owners of registered trademarks
|
||||||
or other rights. ]
|
or other rights. ]
|
||||||
|
|
||||||
[ Feel free to contact us if you have commercial compression requirements
|
|
||||||
or interesting job offers. ]
|
|
||||||
|
|
||||||
|
|||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
ooooo ooo ooooooooo. ooooooo ooooo
|
|
||||||
`888' `8' `888 `Y88. `8888 d8'
|
|
||||||
888 8 888 .d88' Y888..8P
|
|
||||||
888 8 888ooo88P' `8888'
|
|
||||||
888 8 888 .8PY888.
|
|
||||||
`88. .8' 888 d8' `888b
|
|
||||||
`YbodP' o888o o888o o88888o
|
|
||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
|
||||||
http://upx.sourceforge.net
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MAJOR NEWS IN UPX 2
|
|
||||||
===================
|
|
||||||
|
|
||||||
The main news since 1.25 are:
|
|
||||||
|
|
||||||
* new format: added support for arm/pe (ARM executables running on WinCE)
|
|
||||||
* new format: added support for linux elf/amd64
|
|
||||||
* new format: added support for linux elf/ppc32
|
|
||||||
* new format: added support for mach/ppc32 (Apple Mac OS X)
|
|
||||||
* new format: added support for bootable Linux kernels ("vmlinuz/386")
|
|
||||||
* new format: added support for Playstation exes ("ps1/exe")
|
|
||||||
|
|
||||||
* slightly better compression using the new NRV2E algorithm
|
|
||||||
* new options for compression tuning (e.g. '--brute')
|
|
||||||
* improved win32/pe compatibility
|
|
||||||
* direct ELF-to-memory decompression
|
|
||||||
* various bug fixes
|
|
||||||
|
|
||||||
+14
-75
@@ -27,21 +27,6 @@ Foreword
|
|||||||
Markus & Laszlo
|
Markus & Laszlo
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
Welcome to the UPX source code release!
|
|
||||||
|
|
||||||
UPX is not a toy for kids. Apart from basic knowledge about executables
|
|
||||||
and data compression you will need to be firm in C++, assembler,
|
|
||||||
Perl and Makefiles. Probably some other things as well.
|
|
||||||
|
|
||||||
If you can't manage to compile it then the sources are
|
|
||||||
probably not for you. Don't email us for help.
|
|
||||||
|
|
||||||
The authors use Linux for development. You might want to as well.
|
|
||||||
|
|
||||||
|
|
||||||
Short overview
|
Short overview
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
@@ -56,66 +41,33 @@ Short overview
|
|||||||
are #included by the individual executable format handlers.
|
are #included by the individual executable format handlers.
|
||||||
|
|
||||||
|
|
||||||
Prerequisites
|
|
||||||
-------------
|
|
||||||
|
|
||||||
- first of all you need to build the UCL compression library
|
|
||||||
http://www.oberhumer.com/opensource/ucl/
|
|
||||||
|
|
||||||
|
|
||||||
Tools needed to build/modify the UPX sources
|
Tools needed to build/modify the UPX sources
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
- A C++ compiler supporting inner classes, templates, exceptions
|
- A C++ compiler that supports C++ 14: clang, gcc or msvc
|
||||||
and RTTI.
|
|
||||||
|
|
||||||
- GNU make 3.80 or better
|
- GNU make
|
||||||
|
|
||||||
|
- CMake 3.13 or better; see https://cmake.org/
|
||||||
|
|
||||||
|
|
||||||
To compile the packer sources
|
To compile the packer sources
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
set the environment variable UCLDIR to point to your UCL installation, e.g.
|
- just run "make" in the top-level source directory
|
||||||
|
|
||||||
set UCLDIR=c:\src\ucl-1.03 (DOS / Windows)
|
|
||||||
export UCLDIR=$HOME/local/src/ucl-1.03 (Unix)
|
|
||||||
|
|
||||||
then type
|
|
||||||
|
|
||||||
make target=linux # linux
|
|
||||||
make target=djgpp2 # dos32 - djgpp2
|
|
||||||
make target=cygwin # win32 - cygwin 1.3.x
|
|
||||||
make target=mingw32 # win32 - mingw32
|
|
||||||
make target=no-cygwin # win32 - mingw32 as included in cygwin
|
|
||||||
|
|
||||||
|
|
||||||
If you want to modify the stub sources you'll also need
|
If you want to modify the stub sources you'll also need
|
||||||
-------------------------------------------------------
|
-------------------------------------------------------
|
||||||
|
|
||||||
- A68K - a 68000 macro assembler
|
- Podman/Docker: see misc/rebuild-stubs-with-podman - this
|
||||||
http://upx.sourceforge.net/download/tools/
|
is the preferred way of rebuilding the stubs
|
||||||
|
|
||||||
- ASM5900 - a MIPS R3000 assembler
|
- otherwise you will need:
|
||||||
http://upx.sourceforge.net/download/tools/
|
- a Linux host system with Perl, Python2 and some older compat-libs
|
||||||
|
- upx-stubtools - a number of cross-assemblers and cross-compilers.
|
||||||
- djasm - an assembler for the djgpp stub
|
Precompiled binaries for amd64-linux hosts are available from
|
||||||
http://upx.sourceforge.net/download/tools/
|
https://github.com/upx/upx-stubtools/releases
|
||||||
|
|
||||||
- nasm 0.98.39 - the Netwide Assembler
|
|
||||||
http://upx.sourceforge.net/download/tools/
|
|
||||||
http://sourceforge.net/projects/nasm/
|
|
||||||
|
|
||||||
- Perl & Python
|
|
||||||
|
|
||||||
- Certain versions of some i386-linux tools:
|
|
||||||
- gcc-2.95.3
|
|
||||||
- gcc-3.4.6
|
|
||||||
- binutils-2.16.1
|
|
||||||
|
|
||||||
- Other cross compilers targeted at the following architectures:
|
|
||||||
- arm-9tdmi-linux-gnu
|
|
||||||
- powerpc-750-linux-gnu
|
|
||||||
- x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
|
|
||||||
Misc. notes
|
Misc. notes
|
||||||
@@ -130,12 +82,10 @@ Misc. notes
|
|||||||
stream.
|
stream.
|
||||||
- Use gcc extensions and other compiler specific stuff only through
|
- Use gcc extensions and other compiler specific stuff only through
|
||||||
macros.
|
macros.
|
||||||
- Keep in mind that it should be possible to build UPX on braindead
|
|
||||||
case insensitive file systems (FAT).
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
Some conventions:
|
Some conventions:
|
||||||
|
-----------------
|
||||||
|
|
||||||
- follow our coding style
|
- follow our coding style
|
||||||
- indent level = 4
|
- indent level = 4
|
||||||
@@ -144,15 +94,4 @@ Some conventions:
|
|||||||
- Use throwSomeException() functions instead of throw SomeException():
|
- Use throwSomeException() functions instead of throw SomeException():
|
||||||
this makes the code shorter if used often.
|
this makes the code shorter if used often.
|
||||||
|
|
||||||
***
|
# vim:set ts=4 sw=4 et:
|
||||||
|
|
||||||
Patches/Contributions
|
|
||||||
|
|
||||||
- Please send us bug fixes/contributions only using
|
|
||||||
|
|
||||||
diff -u oldfile newfile
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
diff -uNr olddirectory newdirectory
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
ooooo ooo ooooooooo. ooooooo ooooo
|
ooooo ooo ooooooooo. ooooooo ooooo
|
||||||
`888' `8' `888 `Y88. `8888 d8'
|
`888' `8' `888 `Y88. `8888 d8'
|
||||||
888 8 888 .d88' Y888..8P
|
888 8 888 .d88' Y888..8P
|
||||||
888 8 888ooo88P' `8888'
|
888 8 888ooo88P' `8888'
|
||||||
888 8 888 .8PY888.
|
888 8 888 .8PY888.
|
||||||
`88. .8' 888 d8' `888b
|
`88. .8' 888 d8' `888b
|
||||||
`YbodP' o888o o888o o88888o
|
`YbodP' o888o o888o o88888o
|
||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
.___.. .
|
.___.. .
|
||||||
@@ -43,6 +43,8 @@ John S. Fine <johnfine@erols.com>
|
|||||||
for the new version of the dos/exe decompressor
|
for the new version of the dos/exe decompressor
|
||||||
Lukundoo <Lukundoo@softhome.net>
|
Lukundoo <Lukundoo@softhome.net>
|
||||||
for beta testing
|
for beta testing
|
||||||
|
Michael Devore
|
||||||
|
for initial dos/exe device driver support
|
||||||
Oleg V. Volkov <rover@lglobus.ru>
|
Oleg V. Volkov <rover@lglobus.ru>
|
||||||
for various FreeBSD specific informations
|
for various FreeBSD specific informations
|
||||||
The Owl & G-RoM
|
The Owl & G-RoM
|
||||||
@@ -51,7 +53,8 @@ Ralph Roth <RalphRoth@gmx.net>
|
|||||||
for reporting several bugs
|
for reporting several bugs
|
||||||
Salvador Eduardo Tropea
|
Salvador Eduardo Tropea
|
||||||
for beta testing
|
for beta testing
|
||||||
|
Stefan Widmann
|
||||||
|
for the win32/pe TLS callback support
|
||||||
The WINE project (http://www.winehq.com/)
|
The WINE project (http://www.winehq.com/)
|
||||||
for lots of useful information found in their PE loader sources
|
for lots of useful information found in their PE loader sources
|
||||||
Natascha
|
Natascha
|
||||||
|
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
UPX TODO list. Last updated 2006-03-11.
|
|
||||||
|
|
||||||
|
|
||||||
IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON:
|
|
||||||
|
|
||||||
- [None]
|
|
||||||
|
|
||||||
|
|
||||||
OTHER:
|
|
||||||
|
|
||||||
- docs: convert docs from upx.pod to use AsciiDoc
|
|
||||||
|
|
||||||
- check all <const_cast> to make sure they are not invalid
|
|
||||||
|
|
||||||
- throwNotCompressible() is not a real error, so make the output nicer
|
|
||||||
(info: bla bla). Also ui.cpp (total_*).
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
IMPROVED COMPRESSION RATIO
|
|
||||||
==========================
|
|
||||||
|
|
||||||
- experiment with new filters
|
|
||||||
|
|
||||||
- implement filters for dos/exe
|
|
||||||
|
|
||||||
- filters: could we exploit a f->firstcall info field ?
|
|
||||||
|
|
||||||
- for small programs (e.g. < 64k), try an additional algorithm
|
|
||||||
to see if it gives better compression
|
|
||||||
|
|
||||||
|
|
||||||
ALL FORMATS
|
|
||||||
===========
|
|
||||||
|
|
||||||
- more thoroughly test the exe-header in canPack()
|
|
||||||
and throw exceptions when encountering bad values.
|
|
||||||
|
|
||||||
- implement `--cpu=486' option to use bswap on the 32-bit formats
|
|
||||||
(if cpu >= 486)
|
|
||||||
|
|
||||||
- consider removing "or ebp,-1" when not needed
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT DJGPP2/COFF
|
|
||||||
==================
|
|
||||||
|
|
||||||
- handle overlays
|
|
||||||
|
|
||||||
- fix default file extension handling when the --coff option is set
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT DOS/EXE
|
|
||||||
==============
|
|
||||||
|
|
||||||
- implement filters
|
|
||||||
|
|
||||||
- add a check so that we don't pack djgpp1 binaries
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT LINUX/386
|
|
||||||
================
|
|
||||||
|
|
||||||
- don't mmap() the temporary output file - this seems to improve
|
|
||||||
file io speed
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT TMT/ADAM
|
|
||||||
===============
|
|
||||||
|
|
||||||
- the decompressors are already aligned, no need for an
|
|
||||||
extra alignment
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WATCOM/LE
|
|
||||||
================
|
|
||||||
|
|
||||||
- handle files without relocations
|
|
||||||
|
|
||||||
- the decompressors are already aligned, no need for an
|
|
||||||
extra alignment
|
|
||||||
|
|
||||||
- fix default file extension handling when the --le option is set
|
|
||||||
|
|
||||||
- handle holes in the file
|
|
||||||
|
|
||||||
- implement compressWithFilters()
|
|
||||||
|
|
||||||
- add a call to verifyOverlappingDecompression()
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WIN16/NE
|
|
||||||
===============
|
|
||||||
|
|
||||||
- implement readFileHeader() to correctly identify a win16/ne
|
|
||||||
executable, so that the call for contribution will get thrown
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WIN32/PE
|
|
||||||
===============
|
|
||||||
|
|
||||||
- fix the section alignment with the Intel compiler
|
|
||||||
|
|
||||||
- decrease runtime memory overhead
|
|
||||||
|
|
||||||
2 - easy - mfx + ml) new switch(es) : do not compress resource types x,y,z
|
|
||||||
or resource names a,b,c
|
|
||||||
|
|
||||||
3 - difficult) don't compress the BSS section and other holes.
|
|
||||||
|
|
||||||
4 - medium - ml) fix when objectalign < 0x1000
|
|
||||||
|
|
||||||
4 - easy - ml) put the original offset of moved resources somewhere into
|
|
||||||
the res.dir. (if it's safe to do)
|
|
||||||
|
|
||||||
4 - ??? - ml) fix FIXMEs
|
|
||||||
|
|
||||||
5 - medium - ml) try to put the preprocessed imports & relocs back to their
|
|
||||||
original section if possible. this could save some virtual memory
|
|
||||||
address space.
|
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-Ivendor
|
||||||
|
-fno-strict-aliasing
|
||||||
|
-fno-strict-overflow
|
||||||
|
-funsigned-char
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
upx.1
|
|
||||||
upx.doc
|
|
||||||
upx.html
|
|
||||||
upx.man
|
|
||||||
upx.ps
|
|
||||||
upx.tex
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
upx.1
|
|
||||||
upx.doc
|
|
||||||
upx.html
|
|
||||||
upx.man
|
|
||||||
upx.ps
|
|
||||||
upx.tex
|
|
||||||
+11
-12
@@ -1,15 +1,15 @@
|
|||||||
ooooo ooo ooooooooo. ooooooo ooooo
|
ooooo ooo ooooooooo. ooooooo ooooo
|
||||||
`888' `8' `888 `Y88. `8888 d8'
|
`888' `8' `888 `Y88. `8888 d8'
|
||||||
888 8 888 .d88' Y888..8P
|
888 8 888 .d88' Y888..8P
|
||||||
888 8 888ooo88P' `8888'
|
888 8 888ooo88P' `8888'
|
||||||
888 8 888 .8PY888.
|
888 8 888 .8PY888.
|
||||||
`88. .8' 888 d8' `888b
|
`88. .8' 888 d8' `888b
|
||||||
`YbodP' o888o o888o o88888o
|
`YbodP' o888o o888o o88888o
|
||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
Limitations and other things which are not (yet) supported:
|
Limitations and other things which are not (yet) supported:
|
||||||
@@ -28,7 +28,7 @@ dos/exe
|
|||||||
watcom/le
|
watcom/le
|
||||||
---------
|
---------
|
||||||
* 16-bit selector alias fixups
|
* 16-bit selector alias fixups
|
||||||
* 16-bit offset relocation for objects larger than 4 kB
|
* 16-bit offset relocation for objects larger than 4 KiB
|
||||||
* 16:16 fixups
|
* 16:16 fixups
|
||||||
|
|
||||||
If you need any of the above (they're very rare), send us an URL of a
|
If you need any of the above (they're very rare), send us an URL of a
|
||||||
@@ -44,8 +44,7 @@ test file.
|
|||||||
|
|
||||||
win32/pe
|
win32/pe
|
||||||
--------
|
--------
|
||||||
* writeable shared sections (`--force' *may* work)
|
* writable shared sections (`--force' *may* work)
|
||||||
* certificates in the image
|
* certificates in the image
|
||||||
* compressing files which contain a big BSS requires lots of memory
|
* compressing files which contain a big BSS requires lots of memory
|
||||||
during compression
|
during compression
|
||||||
|
|
||||||
+45
-31
@@ -1,36 +1,42 @@
|
|||||||
|
#
|
||||||
|
# UPX doc Makefile - needs GNU make
|
||||||
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
top_srcdir = ..
|
# internal make variables
|
||||||
|
comma := ,
|
||||||
|
empty :=
|
||||||
|
space := $(empty) $(empty)
|
||||||
|
tab := $(empty) $(empty)
|
||||||
|
|
||||||
|
|
||||||
|
# /***********************************************************************
|
||||||
|
# //
|
||||||
|
# ************************************************************************/
|
||||||
|
|
||||||
|
top_srcdir ?= ..
|
||||||
|
|
||||||
PACKAGE = upx
|
PACKAGE = upx
|
||||||
VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION_DATE := $(shell sed -n 's/^.*UPX_VERSION_DATE_ISO .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING .*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
|
|
||||||
TRIMSPACE = cat
|
RTRIM := sed -e 's/[ $(tab)]*$$//'
|
||||||
TRIMSPACE = sed -e 's/ *$$//'
|
DETAB2 := sed -e 's/$(tab)/ /g'
|
||||||
|
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex
|
BUILT_SOURCES = upx.1 upx-doc.html upx-doc.txt
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
###
|
### targets
|
||||||
###
|
###
|
||||||
|
|
||||||
all: $(BUILT_SOURCES)
|
all: $(BUILT_SOURCES)
|
||||||
|
|
||||||
mostlyclean:
|
mostlyclean clean distclean maintainer-clean:
|
||||||
-rm -f $(BUILT_SOURCES) pod2htm*
|
rm -f $(BUILT_SOURCES) pod2htm*
|
||||||
|
|
||||||
clean: mostlyclean
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
|
|
||||||
.SUFFIXES: .1 .doc .html .man .pod .ps .tex .texi
|
|
||||||
|
|
||||||
.PHONY: all mostlyclean clean distclean maintainer-clean
|
.PHONY: all mostlyclean clean distclean maintainer-clean
|
||||||
|
|
||||||
@@ -39,25 +45,32 @@ maintainer-clean: distclean
|
|||||||
### rules
|
### rules
|
||||||
###
|
###
|
||||||
|
|
||||||
.pod.1:
|
.SUFFIXES: .1 .html .man .pod .ps .tex .txt
|
||||||
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(TRIMSPACE) > $@
|
|
||||||
|
|
||||||
.pod.html:
|
%.1 : %.pod
|
||||||
### pod2html $< | $(TRIMSPACE) > $@
|
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@
|
||||||
pod2html --noindex $< | $(TRIMSPACE) > $@
|
test -s $@
|
||||||
@-rm -f pod2htm*
|
|
||||||
|
|
||||||
.pod.tex:
|
%-doc.html : %.pod
|
||||||
|
pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@
|
||||||
|
@rm -f pod2htm*
|
||||||
|
test -s $@
|
||||||
|
|
||||||
|
%.man : %.1
|
||||||
|
nroff -man $< | $(RTRIM) > $@
|
||||||
|
test -s $@
|
||||||
|
|
||||||
|
%.ps : %.1
|
||||||
|
groff -man $< | $(RTRIM) > $@
|
||||||
|
test -s $@
|
||||||
|
|
||||||
|
%.tex : %.pod
|
||||||
pod2latex $<
|
pod2latex $<
|
||||||
|
test -s $@
|
||||||
|
|
||||||
.pod.doc:
|
%-doc.txt : %.pod
|
||||||
pod2text < $< | $(TRIMSPACE) > $@
|
pod2text < $< | $(RTRIM) > $@
|
||||||
|
test -s $@
|
||||||
.1.man:
|
|
||||||
nroff -man $< | $(TRIMSPACE) > $@
|
|
||||||
|
|
||||||
.1.ps:
|
|
||||||
groff -man $< | $(TRIMSPACE) > $@
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -65,4 +78,5 @@ maintainer-clean: distclean
|
|||||||
###
|
###
|
||||||
|
|
||||||
$(BUILT_SOURCES): $(top_srcdir)/src/version.h $(MAKEFILE_LIST)
|
$(BUILT_SOURCES): $(top_srcdir)/src/version.h $(MAKEFILE_LIST)
|
||||||
|
.DELETE_ON_ERROR: $(BUILT_SOURCES)
|
||||||
|
|
||||||
|
|||||||
+47
-5
@@ -1,5 +1,5 @@
|
|||||||
Decompressing ELF Directly to Memory on Linux/x86
|
Decompressing ELF Directly to Memory on Linux/x86
|
||||||
Copyright 2000 John F. Reiser jreiser@BitWagon.com
|
Copyright (C) 2000-2022 John F. Reiser jreiser@BitWagon.com
|
||||||
|
|
||||||
References:
|
References:
|
||||||
<elf.h> definitions for the ELF file format
|
<elf.h> definitions for the ELF file format
|
||||||
@@ -17,7 +17,7 @@ program itself. So, the decompressor program (which contains the
|
|||||||
compressed version of the original executable) must have the same
|
compressed version of the original executable) must have the same
|
||||||
brk() as the original executable. So, the second PT_LOAD
|
brk() as the original executable. So, the second PT_LOAD
|
||||||
ELF "segment" of the compressed program is used only to set the brk(0).
|
ELF "segment" of the compressed program is used only to set the brk(0).
|
||||||
See src/p_lx_elf.cpp, function PackLinuxI386elf::patchLoader().
|
See src/p_lx_elf.cpp, function PackLinuxElf32::generateElfHdr.
|
||||||
All of the decompressor's code, and all of the compressed image
|
All of the decompressor's code, and all of the compressed image
|
||||||
of the original executable, reside in the first PT_LOAD of the
|
of the original executable, reside in the first PT_LOAD of the
|
||||||
decompressor program.
|
decompressor program.
|
||||||
@@ -46,8 +46,8 @@ may not be used to take the address of a function.
|
|||||||
|
|
||||||
The address 0x00400000 was chosen to be out of the way of the usual
|
The address 0x00400000 was chosen to be out of the way of the usual
|
||||||
load address 0x08048000, and to minimize fragmentation in kernel
|
load address 0x08048000, and to minimize fragmentation in kernel
|
||||||
page tables; one page of page tables covers 4MB. The address
|
page tables; one page of page tables covers 4 MiB. The address
|
||||||
0x00401000 was chosen as 1 page up from a 64KB boundary, to
|
0x00401000 was chosen as 1 page up from a 64 KiB boundary, to
|
||||||
make the startup code and its constants smaller.
|
make the startup code and its constants smaller.
|
||||||
|
|
||||||
Decompression of the executable begins by decompressing the Elf32_Ehdr
|
Decompression of the executable begins by decompressing the Elf32_Ehdr
|
||||||
@@ -57,9 +57,51 @@ Subroutine do_xmap() of src/stub/l_lx_elf.c performs the
|
|||||||
"virtual execve()" using the compressed data as source, and stores
|
"virtual execve()" using the compressed data as source, and stores
|
||||||
the decompressed bytes directly into the appropriate virtual addresses.
|
the decompressed bytes directly into the appropriate virtual addresses.
|
||||||
|
|
||||||
Before transfering control to the PT_INTERP "program interpreter",
|
Before transferring control to the PT_INTERP "program interpreter",
|
||||||
minor tricks are required to setup the Elf32_auxv_t entries,
|
minor tricks are required to setup the Elf32_auxv_t entries,
|
||||||
clear the free portion of the stack (to compensate for ld-linux.so.2
|
clear the free portion of the stack (to compensate for ld-linux.so.2
|
||||||
assuming that its automatic stack variables are initialized to zero),
|
assuming that its automatic stack variables are initialized to zero),
|
||||||
and remove (all but 4 bytes of) the decompression program (and
|
and remove (all but 4 bytes of) the decompression program (and
|
||||||
compressed executable) from the address space.
|
compressed executable) from the address space.
|
||||||
|
|
||||||
|
As of upx-3.05, by default on Linux, upon decompression then one page
|
||||||
|
of the compressed executable remains mapped into the address space
|
||||||
|
of the process. If all of the pages of the compressed executable are
|
||||||
|
unmapped, then the Linux kernel erases the symlink /proc/self/exe,
|
||||||
|
and this can cause trouble for the runtime shared library loader
|
||||||
|
expanding $ORIGIN in -rpath, or for application code that relies on
|
||||||
|
/proc/self/exe. Use the compress-time command-line option
|
||||||
|
--unmap-all-pages to achieve that effect at run time. Upx-3.04
|
||||||
|
and previous versions did this by default with no option. However,
|
||||||
|
too much other software erroneously assumes that /proc/self/exe
|
||||||
|
always exists.
|
||||||
|
|
||||||
|
On arm*-linux-elf there is no good address at which to retain one
|
||||||
|
page of the compressed executable. Pages below the usual .p_vaddr
|
||||||
|
0x8000 (32KiB) are rejected by the kernel. Using a page above the
|
||||||
|
original uncompressed brk(0) would require placing the entire initial
|
||||||
|
compressed program above uncompressed brk(0), which would significantly
|
||||||
|
increase the running brk(0); but too many programs break if brk(0)
|
||||||
|
moves. Thus on arm*-linux-elf the compressed executable begins
|
||||||
|
with 0x8000==.p_vaddr, all pages mapped by execve() that are also
|
||||||
|
occupied by decompressed bytes are removed before overwriting, and
|
||||||
|
/proc/self/exe becomes a "(deleted)" symlink. It might be possible
|
||||||
|
to preserve /proc/self/exe if the original uncompressed executable
|
||||||
|
were created with 0x9000==.p_vaddr (one page higher than the usual
|
||||||
|
0x8000) so that the compressed page mapped at 0x8000 would linger.
|
||||||
|
[This has not been tested.]
|
||||||
|
|
||||||
|
Linux stores the pathname argument that was specified to execve()
|
||||||
|
immediately after the '\0' which terminates the character string of the
|
||||||
|
last environment variable [as of execve()]. This is true for at least
|
||||||
|
all Linux 2.6, 2.4, and 2.2 kernels. Linux kernel 2.6.29 and later
|
||||||
|
records a pointer to that character string in Elf32_auxv[AT_EXECFN].
|
||||||
|
The pathname is not "bound" to the file as strongly as /proc/self/exe
|
||||||
|
(the file may be changed without affecting the pathname), but the
|
||||||
|
pathname does provide some information. The pathname may be relative
|
||||||
|
to the working directory, so look before any chdir().
|
||||||
|
|
||||||
|
The Elf formats for Linux add an environment variable named " " [three
|
||||||
|
spaces] which saves the results of readlink("/proc/self/exe",,) before
|
||||||
|
the runtime stub unmaps all its pages. As of 2006-10-03 this works
|
||||||
|
for linux/elf386 and linux/ElfAMD.
|
||||||
|
|||||||
+2
-2
@@ -108,14 +108,14 @@ then skip another one - the unfiltering process needs some information
|
|||||||
to be able to reverse the filtering.
|
to be able to reverse the filtering.
|
||||||
|
|
||||||
UPX uses the following idea, which works nicely. First we assume that
|
UPX uses the following idea, which works nicely. First we assume that
|
||||||
the size of the area that should be filtered is less than 16MB. Then
|
the size of the area that should be filtered is less than 16 MiB. Then
|
||||||
UPX scans over this area and keeps a record of the bytes that are
|
UPX scans over this area and keeps a record of the bytes that are
|
||||||
following the 0xE8 bytes. If we are lucky, there will be bytes that
|
following the 0xE8 bytes. If we are lucky, there will be bytes that
|
||||||
were not found following 0xE8. These bytes are our candidates to be
|
were not found following 0xE8. These bytes are our candidates to be
|
||||||
used as markers.
|
used as markers.
|
||||||
|
|
||||||
Do you still remember that we assumed that the size of scanned area is
|
Do you still remember that we assumed that the size of scanned area is
|
||||||
less than 16MB? Well, this means that when we process a real call, the
|
less than 16 MiB? Well, this means that when we process a real call, the
|
||||||
resulting offset will be less than 0x00FFFFFF too. So the MSB is always
|
resulting offset will be less than 0x00FFFFFF too. So the MSB is always
|
||||||
0x00. Which is a nice place to store our marker. Of course we should
|
0x00. Which is a nice place to store our marker. Of course we should
|
||||||
reverse the byte order in the resulting offset - so this marker will
|
reverse the byte order in the resulting offset - so this marker will
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
This documentation is written for those brave souls who want to
|
||||||
|
understand and/or modify the UPX assembly stubs - the small snippets
|
||||||
|
that do the runtime decompression when a compressed program is started.
|
||||||
|
|
||||||
|
If you look at the C++ source files, you can find code fragments like
|
||||||
|
this:
|
||||||
|
|
||||||
|
addLoader("PEMAIN20",
|
||||||
|
ih.entry ? "PEDOJUMP" : "PERETURN",
|
||||||
|
"IDENTSTR""UPX1HEAD",
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
linker->defineSymbol("original_entry", ih.entry);
|
||||||
|
|
||||||
|
and in the assembly files fragments like this:
|
||||||
|
|
||||||
|
section PEISDLL1
|
||||||
|
cmpb [esp + 8], 1
|
||||||
|
jnz reloc_end_jmp
|
||||||
|
|
||||||
|
section PEMAIN21
|
||||||
|
reloc_end_jmp:
|
||||||
|
|
||||||
|
section PERETURN
|
||||||
|
xor eax, eax
|
||||||
|
inc eax
|
||||||
|
ret 0x0C
|
||||||
|
section PEDOJUMP
|
||||||
|
jmp original_entry
|
||||||
|
|
||||||
|
Everything works as you would expect. If you want to add the code
|
||||||
|
fragment which is in `section PERETURN' to the runtime stub, then
|
||||||
|
simply use `addLoader("PERETURN")' in the C++ source.
|
||||||
|
|
||||||
|
That's nice, you could say, but how cross section jumps and calls are
|
||||||
|
handled? Well, that is the nicest part of this stuff - they are handled
|
||||||
|
automatically. All you have to do is to add the required sections to the
|
||||||
|
loader using `addLoader()' and the rest is done by upx. It will resolve
|
||||||
|
every conditional or unconditional jumps or subroutine calls for you.
|
||||||
|
|
||||||
|
You can also use (undefined) symbols in the assembly for values that
|
||||||
|
can only be computed during compression time (like `original_entry').
|
||||||
|
These symbols can be defined later in C++ using
|
||||||
|
|
||||||
|
linker->defineSymbol("xx", yy)
|
||||||
|
|
||||||
|
This functionality (we could say it's a simple linker) is achieved by
|
||||||
|
compiling the assembly into an ELF object file which a little C++
|
||||||
|
module (src/linker.cpp) can interpret and work with.
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
This documentation is written for those brave souls who want to
|
|
||||||
understand and/or modify the UPX assembly stubs - the small snippets
|
|
||||||
that do the runtime decompression when a compressed program is started.
|
|
||||||
|
|
||||||
So, how the runtime stub/loader generation works?
|
|
||||||
|
|
||||||
You might have already noticed that for some file formats the loaders
|
|
||||||
are quite simple (linux/i386 & tos) while in the other cases the
|
|
||||||
loaders look very suspicious: they're full of `%ifdef's and contain
|
|
||||||
loads of cryptic comments like `__PERELOC2__'.
|
|
||||||
|
|
||||||
If you look at the C++ source files, however you can notice that these
|
|
||||||
comment strings (without the leading and trailing underscores) are used
|
|
||||||
in the following way:
|
|
||||||
|
|
||||||
addLoader("PEMAIN20",
|
|
||||||
ih.entry ? "PEDOJUMP" : "PERETURN",
|
|
||||||
"IDENTSTR""UPX1HEAD",
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
Basically that's all you have to know: when you want to add a section
|
|
||||||
of assembly code to the runtime loader, you just write
|
|
||||||
|
|
||||||
l_foo.asm
|
|
||||||
---------
|
|
||||||
;__FOOBAR00__
|
|
||||||
|
|
||||||
xor eax, eax
|
|
||||||
label1:
|
|
||||||
jmps label1
|
|
||||||
|
|
||||||
;__FOOBARZZ__
|
|
||||||
|
|
||||||
p_foo.cpp
|
|
||||||
---------
|
|
||||||
|
|
||||||
addLoader("FOOBAR00", NULL);
|
|
||||||
|
|
||||||
This will add the assembly section starting from __FOOBAR00__ and ending
|
|
||||||
before __FOOBARZZ__ to the loader. You can add an %ifdef - %endif pair
|
|
||||||
before these comments if you wish - but these conditionals will NOT be
|
|
||||||
seen by the assembler, they are just syntactic sugar to make the code a
|
|
||||||
little bit more readable and understandable. (Note however, that only
|
|
||||||
%ifdefs which are started on the 1st column are removed by the upx
|
|
||||||
assembly preprocessor program, so you can still use preprocessor
|
|
||||||
conditionals if you wish - just write them starting from the 2nd
|
|
||||||
column.)
|
|
||||||
|
|
||||||
That's nice, you could say, but how cross section jumps and calls are
|
|
||||||
handled? Well, that is the nicest part of this stuff - they are handled
|
|
||||||
automatically. All you have to do is to add the required sections to the
|
|
||||||
loader using `addLoader()' and the rest is done by upx. It will resolve
|
|
||||||
every conditional or unconditional jumps or subrutine calls for you.
|
|
||||||
|
|
||||||
This functionality (we could say it's a simple linker) is achived by the
|
|
||||||
assembly preprocessor (src/stub/scripts/app.pl) and a little C++ module
|
|
||||||
(src/linker.cpp). And of course NASM - the Netwide Assembler. You can
|
|
||||||
see what's going on behind the scenes - just do:
|
|
||||||
|
|
||||||
cd src/stubs
|
|
||||||
make maintainer-clean
|
|
||||||
make all
|
|
||||||
|
|
||||||
This will rebuild all the loaders - and keep the temporary files (*.as[xy])
|
|
||||||
which are seen by the assembler.
|
|
||||||
|
|
||||||
Currently this loader/stub building method only works with ix86
|
|
||||||
assembly - both app.pl and linker.cpp heavily rely on this when dealing
|
|
||||||
with cross section references.
|
|
||||||
|
|
||||||
And finally some important features/requirements you should be aware of:
|
|
||||||
|
|
||||||
- as previously stated - preprocessor conditionals starting on the 1st
|
|
||||||
column are removed by app.pl
|
|
||||||
- sections are separated by comments in the form `;__X1234567__'
|
|
||||||
- jumps are recognized by searching for a word which starts with `j'
|
|
||||||
and followed by a label - this also means that `jmp short label1'
|
|
||||||
will NOT be recognized (but you can use a macro called `jmps' for it
|
|
||||||
by adding `%define jmps jmp short' to the beginning of the file)
|
|
||||||
- at the end of the file you need something like this
|
|
||||||
|
|
||||||
eof:
|
|
||||||
; __XTHEENDX__
|
|
||||||
section .data
|
|
||||||
dd -1
|
|
||||||
dw eof
|
|
||||||
|
|
||||||
That's all for now.
|
|
||||||
+1
-1
@@ -20,7 +20,7 @@ code 127, and a record will be added to the history file
|
|||||||
|
|
||||||
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
||||||
designated processes that run with elevated privileges: web server,
|
designated processes that run with elevated privileges: web server,
|
||||||
print server, login server, etc. Ordinary user excutables receive
|
print server, login server, etc. Ordinary user executables receive
|
||||||
much less scrutiny. However, one of the eventual goals of SELinux is to
|
much less scrutiny. However, one of the eventual goals of SELinux is to
|
||||||
eradicate runtime generation of instructions because of the possibility
|
eradicate runtime generation of instructions because of the possibility
|
||||||
for exploitation by malware (virus, trojan, key logger, privilege
|
for exploitation by malware (virus, trojan, key logger, privilege
|
||||||
|
|||||||
@@ -0,0 +1,809 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>upx - compress or expand executable files</title>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<link rev="made" href="mailto:root@localhost" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 id="NAME">NAME</h1>
|
||||||
|
|
||||||
|
<p>upx - compress or expand executable files</p>
|
||||||
|
|
||||||
|
<h1 id="SYNOPSIS">SYNOPSIS</h1>
|
||||||
|
|
||||||
|
<p><b>upx</b> <span style="white-space: nowrap;">[ <i>command</i> ]</span> <span style="white-space: nowrap;">[ <i>options</i> ]</span> <i>filename</i>...</p>
|
||||||
|
|
||||||
|
<h1 id="ABSTRACT">ABSTRACT</h1>
|
||||||
|
|
||||||
|
<pre><code> The Ultimate Packer for eXecutables
|
||||||
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
|
https://upx.github.io</code></pre>
|
||||||
|
|
||||||
|
<p><b>UPX</b> is a portable, extendable, high-performance executable packer for several different executable formats. It achieves an excellent compression ratio and offers <i>*very*</i> fast decompression. Your executables suffer no memory overhead or other drawbacks for most of the formats supported, because of in-place decompression.</p>
|
||||||
|
|
||||||
|
<h1 id="DISCLAIMER">DISCLAIMER</h1>
|
||||||
|
|
||||||
|
<p><b>UPX</b> comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING.</p>
|
||||||
|
|
||||||
|
<p>Please report all problems or suggestions to the authors. Thanks.</p>
|
||||||
|
|
||||||
|
<h1 id="SECURITY-CONTEXT">SECURITY CONTEXT</h1>
|
||||||
|
|
||||||
|
<p>IMPORTANT NOTE: <b>UPX</b> inherits the security context of any files it handles.</p>
|
||||||
|
|
||||||
|
<p>This means that packing, unpacking, or even testing or listing a file requires the same security considerations as actually executing the file.</p>
|
||||||
|
|
||||||
|
<p>Use <b>UPX</b> on trusted files only!</p>
|
||||||
|
|
||||||
|
<h1 id="DESCRIPTION">DESCRIPTION</h1>
|
||||||
|
|
||||||
|
<p><b>UPX</b> is a versatile executable packer with the following features:</p>
|
||||||
|
|
||||||
|
<pre><code>- secure: as UPX is documented Open Source since many years any relevant
|
||||||
|
Security/Antivirus software is able to peek inside UPX compressed
|
||||||
|
apps to verify them
|
||||||
|
|
||||||
|
- excellent compression ratio: typically compresses better than Zip,
|
||||||
|
use UPX to decrease the size of your distribution !
|
||||||
|
|
||||||
|
- very fast decompression: more than 500 MB/sec on any reasonably modern
|
||||||
|
machine
|
||||||
|
|
||||||
|
- no memory overhead for your compressed executables for most of the
|
||||||
|
supported formats because of in-place decompression
|
||||||
|
|
||||||
|
- safe: you can list, test and unpack your executables.
|
||||||
|
Also, a checksum of both the compressed and uncompressed file is
|
||||||
|
maintained internally.
|
||||||
|
|
||||||
|
- universal: UPX can pack a number of executable formats, including
|
||||||
|
Windows programs and DLLs, macOS apps and Linux executables
|
||||||
|
|
||||||
|
- portable: UPX is written in portable endian-neutral C++
|
||||||
|
|
||||||
|
- extendable: because of the class layout it's very easy to support
|
||||||
|
new executable formats or add new compression algorithms
|
||||||
|
|
||||||
|
- free: UPX is distributed with full source code under the GNU General
|
||||||
|
Public License v2+, with special exceptions granting the free usage
|
||||||
|
for commercial programs</code></pre>
|
||||||
|
|
||||||
|
<p>You probably understand now why we call <b>UPX</b> the "<i>ultimate</i>" executable packer.</p>
|
||||||
|
|
||||||
|
<h1 id="COMMANDS">COMMANDS</h1>
|
||||||
|
|
||||||
|
<h2 id="Compress">Compress</h2>
|
||||||
|
|
||||||
|
<p>This is the default operation, eg. <b>upx yourfile.exe</b> will compress the file specified on the command line.</p>
|
||||||
|
|
||||||
|
<h2 id="Decompress">Decompress</h2>
|
||||||
|
|
||||||
|
<p>All <b>UPX</b> supported file formats can be unpacked using the <b>-d</b> switch, eg. <b>upx -d yourfile.exe</b> will uncompress the file you've just compressed.</p>
|
||||||
|
|
||||||
|
<h2 id="Test">Test</h2>
|
||||||
|
|
||||||
|
<p>The <b>-t</b> command tests the integrity of the compressed and uncompressed data, eg. <b>upx -t yourfile.exe</b> check whether your file can be safely decompressed. Note, that this command doesn't check the whole file, only the part that will be uncompressed during program execution. This means that you should not use this command instead of a virus checker.</p>
|
||||||
|
|
||||||
|
<h2 id="List">List</h2>
|
||||||
|
|
||||||
|
<p>The <b>-l</b> command prints out some information about the compressed files specified on the command line as parameters, eg <b>upx -l yourfile.exe</b> shows the compressed / uncompressed size and the compression ratio of <i>yourfile.exe</i>.</p>
|
||||||
|
|
||||||
|
<h1 id="OPTIONS">OPTIONS</h1>
|
||||||
|
|
||||||
|
<p><b>-q</b>: be quiet, suppress warnings</p>
|
||||||
|
|
||||||
|
<p><b>-q -q</b> (or <b>-qq</b>): be very quiet, suppress errors</p>
|
||||||
|
|
||||||
|
<p><b>-q -q -q</b> (or <b>-qqq</b>): produce no output at all</p>
|
||||||
|
|
||||||
|
<p><b>--help</b>: prints the help</p>
|
||||||
|
|
||||||
|
<p><b>--version</b>: print the version of <b>UPX</b></p>
|
||||||
|
|
||||||
|
<p><b>--exact</b>: when compressing, require to be able to get a byte-identical file after decompression with option <b>-d</b>. [NOTE: this is work in progress and is not supported for all formats yet. If you do care, as a workaround you can compress and then decompress your program a first time - any further compress-decompress steps should then yield byte-identical results as compared to the first decompressed version.]</p>
|
||||||
|
|
||||||
|
<p><b>-k</b>: keep backup files</p>
|
||||||
|
|
||||||
|
<p><b>-o file</b>: write output to file</p>
|
||||||
|
|
||||||
|
<p>[ ...more docs need to be written... - type `<b>upx --help</b>' for now ]</p>
|
||||||
|
|
||||||
|
<h1 id="COMPRESSION-LEVELS-TUNING">COMPRESSION LEVELS & TUNING</h1>
|
||||||
|
|
||||||
|
<p><b>UPX</b> offers ten different compression levels from <b>-1</b> to <b>-9</b>, and <b>--best</b>. The default compression level is <b>-8</b> for files smaller than 512 KiB, and <b>-7</b> otherwise.</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li><p>Compression levels 1, 2 and 3 are pretty fast.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>Compression levels 4, 5 and 6 achieve a good time/ratio performance.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>Compression levels 7, 8 and 9 favor compression ratio over speed.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>Compression level <b>--best</b> may take a long time.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Note that compression level <b>--best</b> can be somewhat slow for large files, but you definitely should use it when releasing a final version of your program.</p>
|
||||||
|
|
||||||
|
<p>Quick info for achieving the best compression ratio:</p>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
|
||||||
|
<li><p>Try <b>upx --brute --no-lzma myfile.exe</b> or even <b>upx --ultra-brute --no-lzma myfile.exe</b>.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>The option <b>--lzma</b> enables LZMA compression, which compresses better but is *significantly slower* at decompression. You probably do not want to use it for large files.</p>
|
||||||
|
|
||||||
|
<p>(Note that <b>--lzma</b> is automatically enabled by <b>--all-methods</b> and <b>--brute</b>, use <b>--no-lzma</b> to override.)</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>Try if <b>--overlay=strip</b> works.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><p>For win32/pe programs there's <b>--strip-relocs=0</b>. See notes below.</p>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h1 id="OVERLAY-HANDLING-OPTIONS">OVERLAY HANDLING OPTIONS</h1>
|
||||||
|
|
||||||
|
<p>Info: An "overlay" means auxiliary data attached after the logical end of an executable, and it often contains application specific data (this is a common practice to avoid an extra data file, though it would be better to use resource sections).</p>
|
||||||
|
|
||||||
|
<p><b>UPX</b> handles overlays like many other executable packers do: it simply copies the overlay after the compressed image. This works with some files, but doesn't work with others, depending on how an application actually accesses this overlayed data.</p>
|
||||||
|
|
||||||
|
<pre><code>--overlay=copy Copy any extra data attached to the file. [DEFAULT]
|
||||||
|
|
||||||
|
--overlay=strip Strip any overlay from the program instead of
|
||||||
|
copying it. Be warned, this may make the compressed
|
||||||
|
program crash or otherwise unusable.
|
||||||
|
|
||||||
|
--overlay=skip Refuse to compress any program which has an overlay.</code></pre>
|
||||||
|
|
||||||
|
<h1 id="ENVIRONMENT-VARIABLE">ENVIRONMENT VARIABLE</h1>
|
||||||
|
|
||||||
|
<p>The environment variable <b>UPX</b> can hold a set of default options for <b>UPX</b>. These options are interpreted first and can be overwritten by explicit command line parameters. For example:</p>
|
||||||
|
|
||||||
|
<pre><code>for DOS/Windows: set UPX=-9 --compress-icons#0
|
||||||
|
for sh/ksh/zsh: UPX="-9 --compress-icons=0"; export UPX
|
||||||
|
for csh/tcsh: setenv UPX "-9 --compress-icons=0"</code></pre>
|
||||||
|
|
||||||
|
<p>Under DOS/Windows you must use '#' instead of '=' when setting the environment variable because of a COMMAND.COM limitation.</p>
|
||||||
|
|
||||||
|
<p>Not all of the options are valid in the environment variable - <b>UPX</b> will tell you.</p>
|
||||||
|
|
||||||
|
<p>You can explicitly use the <b>--no-env</b> option to ignore the environment variable.</p>
|
||||||
|
|
||||||
|
<h1 id="NOTES-FOR-THE-SUPPORTED-EXECUTABLE-FORMATS">NOTES FOR THE SUPPORTED EXECUTABLE FORMATS</h1>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-ATARI-TOS">NOTES FOR ATARI/TOS</h2>
|
||||||
|
|
||||||
|
<p>This is the executable format used by the Atari ST/TT, a Motorola 68000 based personal computer which was popular in the late '80s. Support of this format is only because of nostalgic feelings of one of the authors and serves no practical purpose :-). See https://freemint.github.io for more info.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression. All debug information will be stripped, though.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-BVMLINUZ-I386">NOTES FOR BVMLINUZ/I386</h2>
|
||||||
|
|
||||||
|
<p>Same as vmlinuz/i386.</p>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-DOS-COM">NOTES FOR DOS/COM</h2>
|
||||||
|
|
||||||
|
<p>Obviously <b>UPX</b> won't work with executables that want to read data from themselves (like some commandline utilities that ship with Win95/98/ME).</p>
|
||||||
|
|
||||||
|
<p>Compressed programs only work on a 286+.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||||
|
|
||||||
|
<p>Maximum uncompressed size: ~65100 bytes.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-DOS-EXE">NOTES FOR DOS/EXE</h2>
|
||||||
|
|
||||||
|
<p>dos/exe stands for all "normal" 16-bit DOS executables.</p>
|
||||||
|
|
||||||
|
<p>Obviously <b>UPX</b> won't work with executables that want to read data from themselves (like some command line utilities that ship with Win95/98/ME).</p>
|
||||||
|
|
||||||
|
<p>Compressed programs only work on a 286+.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--no-reloc Use no relocation records in the exe header.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-DOS-SYS">NOTES FOR DOS/SYS</h2>
|
||||||
|
|
||||||
|
<p>Compressed programs only work on a 286+.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||||
|
|
||||||
|
<p>Maximum uncompressed size: ~65350 bytes.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-DJGPP2-COFF">NOTES FOR DJGPP2/COFF</h2>
|
||||||
|
|
||||||
|
<p>First of all, it is recommended to use <b>UPX</b> *instead* of <b>strip</b>. strip has the very bad habit of replacing your stub with its own (outdated) version. Additionally <b>UPX</b> corrects a bug/feature in strip v2.8.x: it will fix the 4 KiB alignment of the stub.</p>
|
||||||
|
|
||||||
|
<p><b>UPX</b> includes the full functionality of stubify. This means it will automatically stubify your COFF files. Use the option <b>--coff</b> to disable this functionality (see below).</p>
|
||||||
|
|
||||||
|
<p><b>UPX</b> automatically handles Allegro packfiles.</p>
|
||||||
|
|
||||||
|
<p>The DLM format (a rather exotic shared library extension) is not supported.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression. All debug information and trailing garbage will be stripped, though.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--coff Produce COFF output instead of EXE. By default
|
||||||
|
UPX keeps your current stub.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-LINUX-general">NOTES FOR LINUX [general]</h2>
|
||||||
|
|
||||||
|
<p>Introduction</p>
|
||||||
|
|
||||||
|
<pre><code>Linux/386 support in UPX consists of 3 different executable formats,
|
||||||
|
one optimized for ELF executables ("linux/elf386"), one optimized
|
||||||
|
for shell scripts ("linux/sh386"), and one generic format
|
||||||
|
("linux/386").
|
||||||
|
|
||||||
|
We will start with a general discussion first, but please
|
||||||
|
also read the relevant docs for each of the individual formats.
|
||||||
|
|
||||||
|
Also, there is special support for bootable kernels - see the
|
||||||
|
description of the vmlinuz/386 format.</code></pre>
|
||||||
|
|
||||||
|
<p>General user's overview</p>
|
||||||
|
|
||||||
|
<pre><code>Running a compressed executable program trades less space on a
|
||||||
|
``permanent'' storage medium (such as a hard disk, floppy disk,
|
||||||
|
CD-ROM, flash memory, EPROM, etc.) for more space in one or more
|
||||||
|
``temporary'' storage media (such as RAM, swap space, /tmp, etc.).
|
||||||
|
Running a compressed executable also requires some additional CPU
|
||||||
|
cycles to generate the compressed executable in the first place,
|
||||||
|
and to decompress it at each invocation.
|
||||||
|
|
||||||
|
How much space is traded? It depends on the executable, but many
|
||||||
|
programs save 30% to 50% of permanent disk space. How much CPU
|
||||||
|
overhead is there? Again, it depends on the executable, but
|
||||||
|
decompression speed generally is at least many megabytes per second,
|
||||||
|
and frequently is limited by the speed of the underlying disk
|
||||||
|
or network I/O.
|
||||||
|
|
||||||
|
Depending on the statistics of usage and access, and the relative
|
||||||
|
speeds of CPU, RAM, swap space, /tmp, and file system storage, then
|
||||||
|
invoking and running a compressed executable can be faster than
|
||||||
|
directly running the corresponding uncompressed program.
|
||||||
|
The operating system might perform fewer expensive I/O operations
|
||||||
|
to invoke the compressed program. Paging to or from swap space
|
||||||
|
or /tmp might be faster than paging from the general file system.
|
||||||
|
``Medium-sized'' programs which access about 1/3 to 1/2 of their
|
||||||
|
stored program bytes can do particularly well with compression.
|
||||||
|
Small programs tend not to benefit as much because the absolute
|
||||||
|
savings is less. Big programs tend not to benefit proportionally
|
||||||
|
because each invocation may use only a small fraction of the program,
|
||||||
|
yet UPX decompresses the entire program before invoking it.
|
||||||
|
But in environments where disk or flash memory storage is limited,
|
||||||
|
then compression may win anyway.
|
||||||
|
|
||||||
|
Currently, executables compressed by UPX do not share RAM at runtime
|
||||||
|
in the way that executables mapped from a file system do. As a
|
||||||
|
result, if the same program is run simultaneously by more than one
|
||||||
|
process, then using the compressed version will require more RAM and/or
|
||||||
|
swap space. So, shell programs (bash, csh, etc.) and ``make''
|
||||||
|
might not be good candidates for compression.
|
||||||
|
|
||||||
|
UPX recognizes three executable formats for Linux: Linux/elf386,
|
||||||
|
Linux/sh386, and Linux/386. Linux/386 is the most generic format;
|
||||||
|
it accommodates any file that can be executed. At runtime, the UPX
|
||||||
|
decompression stub re-creates in /tmp a copy of the original file,
|
||||||
|
and then the copy is (re-)executed with the same arguments.
|
||||||
|
ELF binary executables prefer the Linux/elf386 format by default,
|
||||||
|
because UPX decompresses them directly into RAM, uses only one
|
||||||
|
exec, does not use space in /tmp, and does not use /proc.
|
||||||
|
Shell scripts where the underlying shell accepts a ``-c'' argument
|
||||||
|
can use the Linux/sh386 format. UPX decompresses the shell script
|
||||||
|
into low memory, then maps the shell and passes the entire text of the
|
||||||
|
script as an argument with a leading ``-c''.</code></pre>
|
||||||
|
|
||||||
|
<p>General benefits:</p>
|
||||||
|
|
||||||
|
<pre><code>- UPX can compress all executables, be it AOUT, ELF, libc4, libc5,
|
||||||
|
libc6, Shell/Perl/Python/... scripts, standalone Java .class
|
||||||
|
binaries, or whatever...
|
||||||
|
All scripts and programs will work just as before.
|
||||||
|
|
||||||
|
- Compressed programs are completely self-contained. No need for
|
||||||
|
any external program.
|
||||||
|
|
||||||
|
- UPX keeps your original program untouched. This means that
|
||||||
|
after decompression you will have a byte-identical version,
|
||||||
|
and you can use UPX as a file compressor just like gzip.
|
||||||
|
[ Note that UPX maintains a checksum of the file internally,
|
||||||
|
so it is indeed a reliable alternative. ]
|
||||||
|
|
||||||
|
- As the stub only uses syscalls and isn't linked against libc it
|
||||||
|
should run under any Linux configuration that can run ELF
|
||||||
|
binaries.
|
||||||
|
|
||||||
|
- For the same reason compressed executables should run under
|
||||||
|
FreeBSD and other systems which can run Linux binaries.
|
||||||
|
[ Please send feedback on this topic ]</code></pre>
|
||||||
|
|
||||||
|
<p>General drawbacks:</p>
|
||||||
|
|
||||||
|
<pre><code>- It is not advisable to compress programs which usually have many
|
||||||
|
instances running (like `sh' or `make') because the common segments of
|
||||||
|
compressed programs won't be shared any longer between different
|
||||||
|
processes.
|
||||||
|
|
||||||
|
- `ldd' and `size' won't show anything useful because all they
|
||||||
|
see is the statically linked stub. Since version 0.82 the section
|
||||||
|
headers are stripped from the UPX stub and `size' doesn't even
|
||||||
|
recognize the file format. The file patches/patch-elfcode.h has a
|
||||||
|
patch to fix this bug in `size' and other programs which use GNU BFD.</code></pre>
|
||||||
|
|
||||||
|
<p>General notes:</p>
|
||||||
|
|
||||||
|
<pre><code>- As UPX leaves your original program untouched it is advantageous
|
||||||
|
to strip it before compression.
|
||||||
|
|
||||||
|
- If you compress a script you will lose platform independence -
|
||||||
|
this could be a problem if you are using NFS mounted disks.
|
||||||
|
|
||||||
|
- Compression of suid, guid and sticky-bit programs is rejected
|
||||||
|
because of possible security implications.
|
||||||
|
|
||||||
|
- For the same reason there is no sense in making any compressed
|
||||||
|
program suid.
|
||||||
|
|
||||||
|
- Obviously UPX won't work with executables that want to read data
|
||||||
|
from themselves. E.g., this might be a problem for Perl scripts
|
||||||
|
which access their __DATA__ lines.
|
||||||
|
|
||||||
|
- In case of internal errors the stub will abort with exitcode 127.
|
||||||
|
Typical reasons for this to happen are that the program has somehow
|
||||||
|
been modified after compression.
|
||||||
|
Running `strace -o strace.log compressed_file' will tell you more.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-LINUX-ELF386">NOTES FOR LINUX/ELF386</h2>
|
||||||
|
|
||||||
|
<p>Please read the general Linux description first.</p>
|
||||||
|
|
||||||
|
<p>The linux/elf386 format decompresses directly into RAM, uses only one exec, does not use space in /tmp, and does not use /proc.</p>
|
||||||
|
|
||||||
|
<p>Linux/elf386 is automatically selected for Linux ELF executables.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||||
|
|
||||||
|
<p>How it works:</p>
|
||||||
|
|
||||||
|
<pre><code>For ELF executables, UPX decompresses directly to memory, simulating
|
||||||
|
the mapping that the operating system kernel uses during exec(),
|
||||||
|
including the PT_INTERP program interpreter (if any).
|
||||||
|
The brk() is set by a special PT_LOAD segment in the compressed
|
||||||
|
executable itself. UPX then wipes the stack clean except for
|
||||||
|
arguments, environment variables, and Elf_auxv entries (this is
|
||||||
|
required by bugs in the startup code of /lib/ld-linux.so as of
|
||||||
|
May 2000), and transfers control to the program interpreter or
|
||||||
|
the e_entry address of the original executable.
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.</code></pre>
|
||||||
|
|
||||||
|
<p>Specific drawbacks:</p>
|
||||||
|
|
||||||
|
<pre><code>- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||||
|
RAM and swap space to hold all of the decompressed program during
|
||||||
|
the lifetime of the process. If you already use most of your swap
|
||||||
|
space, then you may run out. A system that is "out of memory"
|
||||||
|
can become fragile. Many programs do not react gracefully when
|
||||||
|
malloc() returns 0. With newer Linux kernels, the kernel
|
||||||
|
may decide to kill some processes to regain memory, and you
|
||||||
|
may not like the kernel's choice of which to kill. Running
|
||||||
|
/usr/bin/top is one way to check on the usage of swap space.</code></pre>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>(none)</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-LINUX-SH386">NOTES FOR LINUX/SH386</h2>
|
||||||
|
|
||||||
|
<p>Please read the general Linux description first.</p>
|
||||||
|
|
||||||
|
<p>Shell scripts where the underling shell accepts a ``-c'' argument can use the Linux/sh386 format. <b>UPX</b> decompresses the shell script into low memory, then maps the shell and passes the entire text of the script as an argument with a leading ``-c''. It does not use space in /tmp, and does not use /proc.</p>
|
||||||
|
|
||||||
|
<p>Linux/sh386 is automatically selected for shell scripts that use a known shell.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||||
|
|
||||||
|
<p>How it works:</p>
|
||||||
|
|
||||||
|
<pre><code>For shell script executables (files beginning with "#!/" or "#! /")
|
||||||
|
where the shell is known to accept "-c <command>", UPX decompresses
|
||||||
|
the file into low memory, then maps the shell (and its PT_INTERP),
|
||||||
|
and passes control to the shell with the entire decompressed file
|
||||||
|
as the argument after "-c". Known shells are sh, ash, bash, bsh, csh,
|
||||||
|
ksh, tcsh, pdksh. Restriction: UPX cannot use this method
|
||||||
|
for shell scripts which use the one optional string argument after
|
||||||
|
the shell name in the script (example: "#! /bin/sh option3\n".)
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.</code></pre>
|
||||||
|
|
||||||
|
<p>Specific drawbacks:</p>
|
||||||
|
|
||||||
|
<pre><code>- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||||
|
RAM and swap space to hold all of the decompressed program during
|
||||||
|
the lifetime of the process. If you already use most of your swap
|
||||||
|
space, then you may run out. A system that is "out of memory"
|
||||||
|
can become fragile. Many programs do not react gracefully when
|
||||||
|
malloc() returns 0. With newer Linux kernels, the kernel
|
||||||
|
may decide to kill some processes to regain memory, and you
|
||||||
|
may not like the kernel's choice of which to kill. Running
|
||||||
|
/usr/bin/top is one way to check on the usage of swap space.</code></pre>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>(none)</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-LINUX-386">NOTES FOR LINUX/386</h2>
|
||||||
|
|
||||||
|
<p>Please read the general Linux description first.</p>
|
||||||
|
|
||||||
|
<p>The generic linux/386 format decompresses to /tmp and needs /proc file system support. It starts the decompressed program via the execve() syscall.</p>
|
||||||
|
|
||||||
|
<p>Linux/386 is only selected if the specialized linux/elf386 and linux/sh386 won't recognize a file.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression.</p>
|
||||||
|
|
||||||
|
<p>How it works:</p>
|
||||||
|
|
||||||
|
<pre><code>For files which are not ELF and not a script for a known "-c" shell,
|
||||||
|
UPX uses kernel execve(), which first requires decompressing to a
|
||||||
|
temporary file in the file system. Interestingly -
|
||||||
|
because of the good memory management of the Linux kernel - this
|
||||||
|
often does not introduce a noticeable delay, and in fact there
|
||||||
|
will be no disk access at all if you have enough free memory as
|
||||||
|
the entire process takes places within the file system buffers.
|
||||||
|
|
||||||
|
A compressed executable consists of the UPX stub and an overlay
|
||||||
|
which contains the original program in a compressed form.
|
||||||
|
|
||||||
|
The UPX stub is a statically linked ELF executable and does
|
||||||
|
the following at program startup:
|
||||||
|
|
||||||
|
1) decompress the overlay to a temporary location in /tmp
|
||||||
|
2) open the temporary file for reading
|
||||||
|
3) try to delete the temporary file and start (execve)
|
||||||
|
the uncompressed program in /tmp using /proc/<pid>/fd/X as
|
||||||
|
attained by step 2)
|
||||||
|
4) if that fails, fork off a subprocess to clean up and
|
||||||
|
start the program in /tmp in the meantime
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.</code></pre>
|
||||||
|
|
||||||
|
<p>Specific drawbacks:</p>
|
||||||
|
|
||||||
|
<pre><code>- You need additional free disk space for the uncompressed program
|
||||||
|
in your /tmp directory. This program is deleted immediately after
|
||||||
|
decompression, but you still need it for the full execution time
|
||||||
|
of the program.
|
||||||
|
|
||||||
|
- You must have /proc file system support as the stub wants to open
|
||||||
|
/proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
|
||||||
|
cannot compress programs that are used during the boot sequence
|
||||||
|
before /proc is mounted.
|
||||||
|
|
||||||
|
- Utilities like `top' will display numerical values in the process
|
||||||
|
name field. This is because Linux computes the process name from
|
||||||
|
the first argument of the last execve syscall (which is typically
|
||||||
|
something like /proc/<pid>/fd/3).
|
||||||
|
|
||||||
|
- Because of temporary decompression to disk the decompression speed
|
||||||
|
is not as fast as with the other executable formats. Still, I can see
|
||||||
|
no noticeable delay when starting programs like my ~3 MiB emacs (which
|
||||||
|
is less than 1 MiB when compressed :-).</code></pre>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--force-execve Force the use of the generic linux/386 "execve"
|
||||||
|
format, i.e. do not try the linux/elf386 and
|
||||||
|
linux/sh386 formats.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-PS1-EXE">NOTES FOR PS1/EXE</h2>
|
||||||
|
|
||||||
|
<p>This is the executable format used by the Sony PlayStation (PSone), a MIPS R3000 based gaming console which is popular since the late '90s. Support of this format is very similar to the Atari one, because of nostalgic feelings of one of the authors.</p>
|
||||||
|
|
||||||
|
<p>Packed programs will be byte-identical to the original after uncompression, until further notice.</p>
|
||||||
|
|
||||||
|
<p>Maximum uncompressed size: ~1.89 / ~7.60 MiB.</p>
|
||||||
|
|
||||||
|
<p>Notes:</p>
|
||||||
|
|
||||||
|
<pre><code>- UPX creates as default a suitable executable for CD-Mastering
|
||||||
|
and console transfer. For a CD-Master main executable you could also try
|
||||||
|
the special option "--boot-only" as described below.
|
||||||
|
It has been reported that upx packed executables are fully compatible with
|
||||||
|
the Sony PlayStation 2 (PS2, PStwo) and Sony PlayStation Portable (PSP) in
|
||||||
|
Sony PlayStation (PSone) emulation mode.
|
||||||
|
|
||||||
|
- Normally the packed files use the same memory areas like the uncompressed
|
||||||
|
versions, so they will not override other memory areas while unpacking.
|
||||||
|
If this isn't possible UPX will abort showing a 'packed data overlap'
|
||||||
|
error. With the "--force" option UPX will relocate the loading address
|
||||||
|
for the packed file, but this isn't a real problem if it is a single or
|
||||||
|
the main executable.</code></pre>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--8-bit Uses 8 bit size compression [default: 32 bit]
|
||||||
|
|
||||||
|
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]
|
||||||
|
|
||||||
|
--boot-only This format is for main exes and CD-Mastering only !
|
||||||
|
It may slightly improve the compression ratio,
|
||||||
|
decompression routines are faster than default ones.
|
||||||
|
But it cannot be used for console transfer !
|
||||||
|
|
||||||
|
--no-align This option disables CD mode 2 data sector format
|
||||||
|
alignment. May slightly improves the compression ratio,
|
||||||
|
but the compressed executable will not boot from a CD.
|
||||||
|
Use it for console transfer only !</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-RTM32-PE-and-ARM-PE">NOTES FOR RTM32/PE and ARM/PE</h2>
|
||||||
|
|
||||||
|
<p>Same as win32/pe.</p>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-TMT-ADAM">NOTES FOR TMT/ADAM</h2>
|
||||||
|
|
||||||
|
<p>This format is used by the TMT Pascal compiler - see http://www.tmt.com/ .</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-VMLINUZ-386">NOTES FOR VMLINUZ/386</h2>
|
||||||
|
|
||||||
|
<p>The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed bootable Linux kernel image ("vmlinuz", "zImage", "bzImage"), gzip-decompress it and re-compress it with the <b>UPX</b> compression method.</p>
|
||||||
|
|
||||||
|
<p>vmlinuz/386 is completely unrelated to the other Linux executable formats, and it does not share any of their drawbacks.</p>
|
||||||
|
|
||||||
|
<p>Notes:</p>
|
||||||
|
|
||||||
|
<pre><code>- Be sure that "vmlinuz/386" or "bvmlinuz/386" is displayed
|
||||||
|
during compression - otherwise a wrong executable format
|
||||||
|
may have been used, and the kernel won't boot.</code></pre>
|
||||||
|
|
||||||
|
<p>Benefits:</p>
|
||||||
|
|
||||||
|
<pre><code>- Better compression (but note that the kernel was already compressed,
|
||||||
|
so the improvement is not as large as with other formats).
|
||||||
|
Still, the bytes saved may be essential for special needs like
|
||||||
|
boot disks.
|
||||||
|
|
||||||
|
For example, this is what I get for my 2.2.16 kernel:
|
||||||
|
1589708 vmlinux
|
||||||
|
641073 bzImage [original]
|
||||||
|
560755 bzImage.upx [compressed by "upx -9"]
|
||||||
|
|
||||||
|
- Much faster decompression at kernel boot time (but kernel
|
||||||
|
decompression speed is not really an issue these days).</code></pre>
|
||||||
|
|
||||||
|
<p>Drawbacks:</p>
|
||||||
|
|
||||||
|
<pre><code>(none)</code></pre>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-WATCOM-LE">NOTES FOR WATCOM/LE</h2>
|
||||||
|
|
||||||
|
<p><b>UPX</b> has been successfully tested with the following extenders: DOS4G, DOS4GW, PMODE/W, DOS32a, CauseWay. The WDOS/X extender is partly supported (for details see the file bugs BUGS).</p>
|
||||||
|
|
||||||
|
<p>DLLs and the LX format are not supported.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--le Produce an unbound LE output instead of
|
||||||
|
keeping the current stub.</code></pre>
|
||||||
|
|
||||||
|
<h2 id="NOTES-FOR-WIN32-PE">NOTES FOR WIN32/PE</h2>
|
||||||
|
|
||||||
|
<p>The PE support in <b>UPX</b> is quite stable now, but probably there are still some incompatibilities with some files.</p>
|
||||||
|
|
||||||
|
<p>Because of the way <b>UPX</b> (and other packers for this format) works, you can see increased memory usage of your compressed files because the whole program is loaded into memory at startup. If you start several instances of huge compressed programs you're wasting memory because the common segments of the program won't get shared across the instances. On the other hand if you're compressing only smaller programs, or running only one instance of larger programs, then this penalty is smaller, but it's still there.</p>
|
||||||
|
|
||||||
|
<p>If you're running executables from network, then compressed programs will load faster, and require less bandwidth during execution.</p>
|
||||||
|
|
||||||
|
<p>DLLs are supported. But UPX compressed DLLs can not share common data and code when they got used by multiple applications. So compressing msvcrt.dll is a waste of memory, but compressing the dll plugins of a particular application may be a better idea.</p>
|
||||||
|
|
||||||
|
<p>Screensavers are supported, with the restriction that the filename must end with ".scr" (as screensavers are handled slightly different than normal exe files).</p>
|
||||||
|
|
||||||
|
<p>UPX compressed PE files have some minor memory overhead (usually in the 10 - 30 KiB range) which can be seen by specifying the "-i" command line switch during compression.</p>
|
||||||
|
|
||||||
|
<p>Extra options available for this executable format:</p>
|
||||||
|
|
||||||
|
<pre><code>--compress-exports=0 Don't compress the export section.
|
||||||
|
Use this if you plan to run the compressed
|
||||||
|
program under Wine.
|
||||||
|
--compress-exports=1 Compress the export section. [DEFAULT]
|
||||||
|
Compression of the export section can improve the
|
||||||
|
compression ratio quite a bit but may not work
|
||||||
|
with all programs (like winword.exe).
|
||||||
|
UPX never compresses the export section of a DLL
|
||||||
|
regardless of this option.
|
||||||
|
|
||||||
|
--compress-icons=0 Don't compress any icons.
|
||||||
|
--compress-icons=1 Compress all but the first icon.
|
||||||
|
--compress-icons=2 Compress all icons which are not in the
|
||||||
|
first icon directory. [DEFAULT]
|
||||||
|
--compress-icons=3 Compress all icons.
|
||||||
|
|
||||||
|
--compress-resources=0 Don't compress any resources at all.
|
||||||
|
|
||||||
|
--keep-resource=list Don't compress resources specified by the list.
|
||||||
|
The members of the list are separated by commas.
|
||||||
|
A list member has the following format: I<type[/name]>.
|
||||||
|
I<Type> is the type of the resource. Standard types
|
||||||
|
must be specified as decimal numbers, user types can be
|
||||||
|
specified by decimal IDs or strings. I<Name> is the
|
||||||
|
identifier of the resource. It can be a decimal number
|
||||||
|
or a string. For example:
|
||||||
|
|
||||||
|
--keep-resource=2/MYBITMAP,5,6/12345
|
||||||
|
|
||||||
|
UPX won't compress the named bitmap resource "MYBITMAP",
|
||||||
|
it leaves every dialog (5) resource uncompressed, and
|
||||||
|
it won't touch the string table resource with identifier
|
||||||
|
12345.
|
||||||
|
|
||||||
|
--force Force compression even when there is an
|
||||||
|
unexpected value in a header field.
|
||||||
|
Use with care.
|
||||||
|
|
||||||
|
--strip-relocs=0 Don't strip relocation records.
|
||||||
|
--strip-relocs=1 Strip relocation records. [DEFAULT]
|
||||||
|
This option only works on executables with base
|
||||||
|
address greater or equal to 0x400000. Usually the
|
||||||
|
compressed files becomes smaller, but some files
|
||||||
|
may become larger. Note that the resulting file will
|
||||||
|
not work under Windows 3.x (Win32s).
|
||||||
|
UPX never strips relocations from a DLL
|
||||||
|
regardless of this option.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.</code></pre>
|
||||||
|
|
||||||
|
<h1 id="DIAGNOSTICS">DIAGNOSTICS</h1>
|
||||||
|
|
||||||
|
<p>Exit status is normally 0; if an error occurs, exit status is 1. If a warning occurs, exit status is 2.</p>
|
||||||
|
|
||||||
|
<p><b>UPX</b>'s diagnostics are intended to be self-explanatory.</p>
|
||||||
|
|
||||||
|
<h1 id="BUGS">BUGS</h1>
|
||||||
|
|
||||||
|
<p>Please report all bugs immediately to the authors.</p>
|
||||||
|
|
||||||
|
<h1 id="AUTHORS">AUTHORS</h1>
|
||||||
|
|
||||||
|
<pre><code>Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com
|
||||||
|
|
||||||
|
Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
|
Jens Medoch <jssg@users.sourceforge.net></code></pre>
|
||||||
|
|
||||||
|
<h1 id="COPYRIGHT">COPYRIGHT</h1>
|
||||||
|
|
||||||
|
<p>Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer</p>
|
||||||
|
|
||||||
|
<p>Copyright (C) 1996-2022 Laszlo Molnar</p>
|
||||||
|
|
||||||
|
<p>Copyright (C) 2000-2022 John F. Reiser</p>
|
||||||
|
|
||||||
|
<p>Copyright (C) 2002-2022 Jens Medoch</p>
|
||||||
|
|
||||||
|
<p>This program may be used freely, and you are welcome to redistribute it under certain conditions.</p>
|
||||||
|
|
||||||
|
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
|
||||||
|
|
||||||
|
<p><b>UPX</b> is distributed with full source code under the terms of the GNU General Public License v2+; either under the pure GPLv2+ (see the file COPYING), or (at your option) under the GPLv+2 with special exceptions and restrictions granting the free usage for commercial programs (see the file LICENSE).</p>
|
||||||
|
|
||||||
|
<p>You should have received a copy of the UPX License Agreements along with this program; see the files COPYING and LICENSE. If not, visit the UPX home page.</p>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
+845
@@ -0,0 +1,845 @@
|
|||||||
|
NAME
|
||||||
|
upx - compress or expand executable files
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
upx [ *command* ] [ *options* ] *filename*...
|
||||||
|
|
||||||
|
ABSTRACT
|
||||||
|
The Ultimate Packer for eXecutables
|
||||||
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
|
https://upx.github.io
|
||||||
|
|
||||||
|
UPX is a portable, extendable, high-performance executable packer for
|
||||||
|
several different executable formats. It achieves an excellent
|
||||||
|
compression ratio and offers **very** fast decompression. Your
|
||||||
|
executables suffer no memory overhead or other drawbacks for most of the
|
||||||
|
formats supported, because of in-place decompression.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
UPX comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING.
|
||||||
|
|
||||||
|
Please report all problems or suggestions to the authors. Thanks.
|
||||||
|
|
||||||
|
SECURITY CONTEXT
|
||||||
|
IMPORTANT NOTE: UPX inherits the security context of any files it
|
||||||
|
handles.
|
||||||
|
|
||||||
|
This means that packing, unpacking, or even testing or listing a file
|
||||||
|
requires the same security considerations as actually executing the
|
||||||
|
file.
|
||||||
|
|
||||||
|
Use UPX on trusted files only!
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
UPX is a versatile executable packer with the following features:
|
||||||
|
|
||||||
|
- secure: as UPX is documented Open Source since many years any relevant
|
||||||
|
Security/Antivirus software is able to peek inside UPX compressed
|
||||||
|
apps to verify them
|
||||||
|
|
||||||
|
- excellent compression ratio: typically compresses better than Zip,
|
||||||
|
use UPX to decrease the size of your distribution !
|
||||||
|
|
||||||
|
- very fast decompression: more than 500 MB/sec on any reasonably modern
|
||||||
|
machine
|
||||||
|
|
||||||
|
- no memory overhead for your compressed executables for most of the
|
||||||
|
supported formats because of in-place decompression
|
||||||
|
|
||||||
|
- safe: you can list, test and unpack your executables.
|
||||||
|
Also, a checksum of both the compressed and uncompressed file is
|
||||||
|
maintained internally.
|
||||||
|
|
||||||
|
- universal: UPX can pack a number of executable formats, including
|
||||||
|
Windows programs and DLLs, macOS apps and Linux executables
|
||||||
|
|
||||||
|
- portable: UPX is written in portable endian-neutral C++
|
||||||
|
|
||||||
|
- extendable: because of the class layout it's very easy to support
|
||||||
|
new executable formats or add new compression algorithms
|
||||||
|
|
||||||
|
- free: UPX is distributed with full source code under the GNU General
|
||||||
|
Public License v2+, with special exceptions granting the free usage
|
||||||
|
for commercial programs
|
||||||
|
|
||||||
|
You probably understand now why we call UPX the "*ultimate*" executable
|
||||||
|
packer.
|
||||||
|
|
||||||
|
COMMANDS
|
||||||
|
Compress
|
||||||
|
This is the default operation, eg. upx yourfile.exe will compress the
|
||||||
|
file specified on the command line.
|
||||||
|
|
||||||
|
Decompress
|
||||||
|
All UPX supported file formats can be unpacked using the -d switch, eg.
|
||||||
|
upx -d yourfile.exe will uncompress the file you've just compressed.
|
||||||
|
|
||||||
|
Test
|
||||||
|
The -t command tests the integrity of the compressed and uncompressed
|
||||||
|
data, eg. upx -t yourfile.exe check whether your file can be safely
|
||||||
|
decompressed. Note, that this command doesn't check the whole file, only
|
||||||
|
the part that will be uncompressed during program execution. This means
|
||||||
|
that you should not use this command instead of a virus checker.
|
||||||
|
|
||||||
|
List
|
||||||
|
The -l command prints out some information about the compressed files
|
||||||
|
specified on the command line as parameters, eg upx -l yourfile.exe
|
||||||
|
shows the compressed / uncompressed size and the compression ratio of
|
||||||
|
*yourfile.exe*.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-q: be quiet, suppress warnings
|
||||||
|
|
||||||
|
-q -q (or -qq): be very quiet, suppress errors
|
||||||
|
|
||||||
|
-q -q -q (or -qqq): produce no output at all
|
||||||
|
|
||||||
|
--help: prints the help
|
||||||
|
|
||||||
|
--version: print the version of UPX
|
||||||
|
|
||||||
|
--exact: when compressing, require to be able to get a byte-identical
|
||||||
|
file after decompression with option -d. [NOTE: this is work in progress
|
||||||
|
and is not supported for all formats yet. If you do care, as a
|
||||||
|
workaround you can compress and then decompress your program a first
|
||||||
|
time - any further compress-decompress steps should then yield
|
||||||
|
byte-identical results as compared to the first decompressed version.]
|
||||||
|
|
||||||
|
-k: keep backup files
|
||||||
|
|
||||||
|
-o file: write output to file
|
||||||
|
|
||||||
|
[ ...more docs need to be written... - type `upx --help' for now ]
|
||||||
|
|
||||||
|
COMPRESSION LEVELS & TUNING
|
||||||
|
UPX offers ten different compression levels from -1 to -9, and --best.
|
||||||
|
The default compression level is -8 for files smaller than 512 KiB, and
|
||||||
|
-7 otherwise.
|
||||||
|
|
||||||
|
* Compression levels 1, 2 and 3 are pretty fast.
|
||||||
|
|
||||||
|
* Compression levels 4, 5 and 6 achieve a good time/ratio performance.
|
||||||
|
|
||||||
|
* Compression levels 7, 8 and 9 favor compression ratio over speed.
|
||||||
|
|
||||||
|
* Compression level --best may take a long time.
|
||||||
|
|
||||||
|
Note that compression level --best can be somewhat slow for large files,
|
||||||
|
but you definitely should use it when releasing a final version of your
|
||||||
|
program.
|
||||||
|
|
||||||
|
Quick info for achieving the best compression ratio:
|
||||||
|
|
||||||
|
* Try upx --brute --no-lzma myfile.exe or even upx --ultra-brute
|
||||||
|
--no-lzma myfile.exe.
|
||||||
|
|
||||||
|
* The option --lzma enables LZMA compression, which compresses better
|
||||||
|
but is *significantly slower* at decompression. You probably do not
|
||||||
|
want to use it for large files.
|
||||||
|
|
||||||
|
(Note that --lzma is automatically enabled by --all-methods and
|
||||||
|
--brute, use --no-lzma to override.)
|
||||||
|
|
||||||
|
* Try if --overlay=strip works.
|
||||||
|
|
||||||
|
* For win32/pe programs there's --strip-relocs=0. See notes below.
|
||||||
|
|
||||||
|
OVERLAY HANDLING OPTIONS
|
||||||
|
Info: An "overlay" means auxiliary data attached after the logical end
|
||||||
|
of an executable, and it often contains application specific data (this
|
||||||
|
is a common practice to avoid an extra data file, though it would be
|
||||||
|
better to use resource sections).
|
||||||
|
|
||||||
|
UPX handles overlays like many other executable packers do: it simply
|
||||||
|
copies the overlay after the compressed image. This works with some
|
||||||
|
files, but doesn't work with others, depending on how an application
|
||||||
|
actually accesses this overlayed data.
|
||||||
|
|
||||||
|
--overlay=copy Copy any extra data attached to the file. [DEFAULT]
|
||||||
|
|
||||||
|
--overlay=strip Strip any overlay from the program instead of
|
||||||
|
copying it. Be warned, this may make the compressed
|
||||||
|
program crash or otherwise unusable.
|
||||||
|
|
||||||
|
--overlay=skip Refuse to compress any program which has an overlay.
|
||||||
|
|
||||||
|
ENVIRONMENT VARIABLE
|
||||||
|
The environment variable UPX can hold a set of default options for UPX.
|
||||||
|
These options are interpreted first and can be overwritten by explicit
|
||||||
|
command line parameters. For example:
|
||||||
|
|
||||||
|
for DOS/Windows: set UPX=-9 --compress-icons#0
|
||||||
|
for sh/ksh/zsh: UPX="-9 --compress-icons=0"; export UPX
|
||||||
|
for csh/tcsh: setenv UPX "-9 --compress-icons=0"
|
||||||
|
|
||||||
|
Under DOS/Windows you must use '#' instead of '=' when setting the
|
||||||
|
environment variable because of a COMMAND.COM limitation.
|
||||||
|
|
||||||
|
Not all of the options are valid in the environment variable - UPX will
|
||||||
|
tell you.
|
||||||
|
|
||||||
|
You can explicitly use the --no-env option to ignore the environment
|
||||||
|
variable.
|
||||||
|
|
||||||
|
NOTES FOR THE SUPPORTED EXECUTABLE FORMATS
|
||||||
|
NOTES FOR ATARI/TOS
|
||||||
|
This is the executable format used by the Atari ST/TT, a Motorola 68000
|
||||||
|
based personal computer which was popular in the late '80s. Support of
|
||||||
|
this format is only because of nostalgic feelings of one of the authors
|
||||||
|
and serves no practical purpose :-). See https://freemint.github.io for
|
||||||
|
more info.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression. All debug information will be stripped, though.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR BVMLINUZ/I386
|
||||||
|
Same as vmlinuz/i386.
|
||||||
|
|
||||||
|
NOTES FOR DOS/COM
|
||||||
|
Obviously UPX won't work with executables that want to read data from
|
||||||
|
themselves (like some commandline utilities that ship with Win95/98/ME).
|
||||||
|
|
||||||
|
Compressed programs only work on a 286+.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression.
|
||||||
|
|
||||||
|
Maximum uncompressed size: ~65100 bytes.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR DOS/EXE
|
||||||
|
dos/exe stands for all "normal" 16-bit DOS executables.
|
||||||
|
|
||||||
|
Obviously UPX won't work with executables that want to read data from
|
||||||
|
themselves (like some command line utilities that ship with
|
||||||
|
Win95/98/ME).
|
||||||
|
|
||||||
|
Compressed programs only work on a 286+.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--no-reloc Use no relocation records in the exe header.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR DOS/SYS
|
||||||
|
Compressed programs only work on a 286+.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression.
|
||||||
|
|
||||||
|
Maximum uncompressed size: ~65350 bytes.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR DJGPP2/COFF
|
||||||
|
First of all, it is recommended to use UPX *instead* of strip. strip has
|
||||||
|
the very bad habit of replacing your stub with its own (outdated)
|
||||||
|
version. Additionally UPX corrects a bug/feature in strip v2.8.x: it
|
||||||
|
will fix the 4 KiB alignment of the stub.
|
||||||
|
|
||||||
|
UPX includes the full functionality of stubify. This means it will
|
||||||
|
automatically stubify your COFF files. Use the option --coff to disable
|
||||||
|
this functionality (see below).
|
||||||
|
|
||||||
|
UPX automatically handles Allegro packfiles.
|
||||||
|
|
||||||
|
The DLM format (a rather exotic shared library extension) is not
|
||||||
|
supported.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression. All debug information and trailing garbage will be
|
||||||
|
stripped, though.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--coff Produce COFF output instead of EXE. By default
|
||||||
|
UPX keeps your current stub.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR LINUX [general]
|
||||||
|
Introduction
|
||||||
|
|
||||||
|
Linux/386 support in UPX consists of 3 different executable formats,
|
||||||
|
one optimized for ELF executables ("linux/elf386"), one optimized
|
||||||
|
for shell scripts ("linux/sh386"), and one generic format
|
||||||
|
("linux/386").
|
||||||
|
|
||||||
|
We will start with a general discussion first, but please
|
||||||
|
also read the relevant docs for each of the individual formats.
|
||||||
|
|
||||||
|
Also, there is special support for bootable kernels - see the
|
||||||
|
description of the vmlinuz/386 format.
|
||||||
|
|
||||||
|
General user's overview
|
||||||
|
|
||||||
|
Running a compressed executable program trades less space on a
|
||||||
|
``permanent'' storage medium (such as a hard disk, floppy disk,
|
||||||
|
CD-ROM, flash memory, EPROM, etc.) for more space in one or more
|
||||||
|
``temporary'' storage media (such as RAM, swap space, /tmp, etc.).
|
||||||
|
Running a compressed executable also requires some additional CPU
|
||||||
|
cycles to generate the compressed executable in the first place,
|
||||||
|
and to decompress it at each invocation.
|
||||||
|
|
||||||
|
How much space is traded? It depends on the executable, but many
|
||||||
|
programs save 30% to 50% of permanent disk space. How much CPU
|
||||||
|
overhead is there? Again, it depends on the executable, but
|
||||||
|
decompression speed generally is at least many megabytes per second,
|
||||||
|
and frequently is limited by the speed of the underlying disk
|
||||||
|
or network I/O.
|
||||||
|
|
||||||
|
Depending on the statistics of usage and access, and the relative
|
||||||
|
speeds of CPU, RAM, swap space, /tmp, and file system storage, then
|
||||||
|
invoking and running a compressed executable can be faster than
|
||||||
|
directly running the corresponding uncompressed program.
|
||||||
|
The operating system might perform fewer expensive I/O operations
|
||||||
|
to invoke the compressed program. Paging to or from swap space
|
||||||
|
or /tmp might be faster than paging from the general file system.
|
||||||
|
``Medium-sized'' programs which access about 1/3 to 1/2 of their
|
||||||
|
stored program bytes can do particularly well with compression.
|
||||||
|
Small programs tend not to benefit as much because the absolute
|
||||||
|
savings is less. Big programs tend not to benefit proportionally
|
||||||
|
because each invocation may use only a small fraction of the program,
|
||||||
|
yet UPX decompresses the entire program before invoking it.
|
||||||
|
But in environments where disk or flash memory storage is limited,
|
||||||
|
then compression may win anyway.
|
||||||
|
|
||||||
|
Currently, executables compressed by UPX do not share RAM at runtime
|
||||||
|
in the way that executables mapped from a file system do. As a
|
||||||
|
result, if the same program is run simultaneously by more than one
|
||||||
|
process, then using the compressed version will require more RAM and/or
|
||||||
|
swap space. So, shell programs (bash, csh, etc.) and ``make''
|
||||||
|
might not be good candidates for compression.
|
||||||
|
|
||||||
|
UPX recognizes three executable formats for Linux: Linux/elf386,
|
||||||
|
Linux/sh386, and Linux/386. Linux/386 is the most generic format;
|
||||||
|
it accommodates any file that can be executed. At runtime, the UPX
|
||||||
|
decompression stub re-creates in /tmp a copy of the original file,
|
||||||
|
and then the copy is (re-)executed with the same arguments.
|
||||||
|
ELF binary executables prefer the Linux/elf386 format by default,
|
||||||
|
because UPX decompresses them directly into RAM, uses only one
|
||||||
|
exec, does not use space in /tmp, and does not use /proc.
|
||||||
|
Shell scripts where the underlying shell accepts a ``-c'' argument
|
||||||
|
can use the Linux/sh386 format. UPX decompresses the shell script
|
||||||
|
into low memory, then maps the shell and passes the entire text of the
|
||||||
|
script as an argument with a leading ``-c''.
|
||||||
|
|
||||||
|
General benefits:
|
||||||
|
|
||||||
|
- UPX can compress all executables, be it AOUT, ELF, libc4, libc5,
|
||||||
|
libc6, Shell/Perl/Python/... scripts, standalone Java .class
|
||||||
|
binaries, or whatever...
|
||||||
|
All scripts and programs will work just as before.
|
||||||
|
|
||||||
|
- Compressed programs are completely self-contained. No need for
|
||||||
|
any external program.
|
||||||
|
|
||||||
|
- UPX keeps your original program untouched. This means that
|
||||||
|
after decompression you will have a byte-identical version,
|
||||||
|
and you can use UPX as a file compressor just like gzip.
|
||||||
|
[ Note that UPX maintains a checksum of the file internally,
|
||||||
|
so it is indeed a reliable alternative. ]
|
||||||
|
|
||||||
|
- As the stub only uses syscalls and isn't linked against libc it
|
||||||
|
should run under any Linux configuration that can run ELF
|
||||||
|
binaries.
|
||||||
|
|
||||||
|
- For the same reason compressed executables should run under
|
||||||
|
FreeBSD and other systems which can run Linux binaries.
|
||||||
|
[ Please send feedback on this topic ]
|
||||||
|
|
||||||
|
General drawbacks:
|
||||||
|
|
||||||
|
- It is not advisable to compress programs which usually have many
|
||||||
|
instances running (like `sh' or `make') because the common segments of
|
||||||
|
compressed programs won't be shared any longer between different
|
||||||
|
processes.
|
||||||
|
|
||||||
|
- `ldd' and `size' won't show anything useful because all they
|
||||||
|
see is the statically linked stub. Since version 0.82 the section
|
||||||
|
headers are stripped from the UPX stub and `size' doesn't even
|
||||||
|
recognize the file format. The file patches/patch-elfcode.h has a
|
||||||
|
patch to fix this bug in `size' and other programs which use GNU BFD.
|
||||||
|
|
||||||
|
General notes:
|
||||||
|
|
||||||
|
- As UPX leaves your original program untouched it is advantageous
|
||||||
|
to strip it before compression.
|
||||||
|
|
||||||
|
- If you compress a script you will lose platform independence -
|
||||||
|
this could be a problem if you are using NFS mounted disks.
|
||||||
|
|
||||||
|
- Compression of suid, guid and sticky-bit programs is rejected
|
||||||
|
because of possible security implications.
|
||||||
|
|
||||||
|
- For the same reason there is no sense in making any compressed
|
||||||
|
program suid.
|
||||||
|
|
||||||
|
- Obviously UPX won't work with executables that want to read data
|
||||||
|
from themselves. E.g., this might be a problem for Perl scripts
|
||||||
|
which access their __DATA__ lines.
|
||||||
|
|
||||||
|
- In case of internal errors the stub will abort with exitcode 127.
|
||||||
|
Typical reasons for this to happen are that the program has somehow
|
||||||
|
been modified after compression.
|
||||||
|
Running `strace -o strace.log compressed_file' will tell you more.
|
||||||
|
|
||||||
|
NOTES FOR LINUX/ELF386
|
||||||
|
Please read the general Linux description first.
|
||||||
|
|
||||||
|
The linux/elf386 format decompresses directly into RAM, uses only one
|
||||||
|
exec, does not use space in /tmp, and does not use /proc.
|
||||||
|
|
||||||
|
Linux/elf386 is automatically selected for Linux ELF executables.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression.
|
||||||
|
|
||||||
|
How it works:
|
||||||
|
|
||||||
|
For ELF executables, UPX decompresses directly to memory, simulating
|
||||||
|
the mapping that the operating system kernel uses during exec(),
|
||||||
|
including the PT_INTERP program interpreter (if any).
|
||||||
|
The brk() is set by a special PT_LOAD segment in the compressed
|
||||||
|
executable itself. UPX then wipes the stack clean except for
|
||||||
|
arguments, environment variables, and Elf_auxv entries (this is
|
||||||
|
required by bugs in the startup code of /lib/ld-linux.so as of
|
||||||
|
May 2000), and transfers control to the program interpreter or
|
||||||
|
the e_entry address of the original executable.
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.
|
||||||
|
|
||||||
|
Specific drawbacks:
|
||||||
|
|
||||||
|
- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||||
|
RAM and swap space to hold all of the decompressed program during
|
||||||
|
the lifetime of the process. If you already use most of your swap
|
||||||
|
space, then you may run out. A system that is "out of memory"
|
||||||
|
can become fragile. Many programs do not react gracefully when
|
||||||
|
malloc() returns 0. With newer Linux kernels, the kernel
|
||||||
|
may decide to kill some processes to regain memory, and you
|
||||||
|
may not like the kernel's choice of which to kill. Running
|
||||||
|
/usr/bin/top is one way to check on the usage of swap space.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
(none)
|
||||||
|
|
||||||
|
NOTES FOR LINUX/SH386
|
||||||
|
Please read the general Linux description first.
|
||||||
|
|
||||||
|
Shell scripts where the underling shell accepts a ``-c'' argument can
|
||||||
|
use the Linux/sh386 format. UPX decompresses the shell script into low
|
||||||
|
memory, then maps the shell and passes the entire text of the script as
|
||||||
|
an argument with a leading ``-c''. It does not use space in /tmp, and
|
||||||
|
does not use /proc.
|
||||||
|
|
||||||
|
Linux/sh386 is automatically selected for shell scripts that use a known
|
||||||
|
shell.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression.
|
||||||
|
|
||||||
|
How it works:
|
||||||
|
|
||||||
|
For shell script executables (files beginning with "#!/" or "#! /")
|
||||||
|
where the shell is known to accept "-c <command>", UPX decompresses
|
||||||
|
the file into low memory, then maps the shell (and its PT_INTERP),
|
||||||
|
and passes control to the shell with the entire decompressed file
|
||||||
|
as the argument after "-c". Known shells are sh, ash, bash, bsh, csh,
|
||||||
|
ksh, tcsh, pdksh. Restriction: UPX cannot use this method
|
||||||
|
for shell scripts which use the one optional string argument after
|
||||||
|
the shell name in the script (example: "#! /bin/sh option3\n".)
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.
|
||||||
|
|
||||||
|
Specific drawbacks:
|
||||||
|
|
||||||
|
- For linux/elf386 and linux/sh386 formats, you will be relying on
|
||||||
|
RAM and swap space to hold all of the decompressed program during
|
||||||
|
the lifetime of the process. If you already use most of your swap
|
||||||
|
space, then you may run out. A system that is "out of memory"
|
||||||
|
can become fragile. Many programs do not react gracefully when
|
||||||
|
malloc() returns 0. With newer Linux kernels, the kernel
|
||||||
|
may decide to kill some processes to regain memory, and you
|
||||||
|
may not like the kernel's choice of which to kill. Running
|
||||||
|
/usr/bin/top is one way to check on the usage of swap space.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
(none)
|
||||||
|
|
||||||
|
NOTES FOR LINUX/386
|
||||||
|
Please read the general Linux description first.
|
||||||
|
|
||||||
|
The generic linux/386 format decompresses to /tmp and needs /proc file
|
||||||
|
system support. It starts the decompressed program via the execve()
|
||||||
|
syscall.
|
||||||
|
|
||||||
|
Linux/386 is only selected if the specialized linux/elf386 and
|
||||||
|
linux/sh386 won't recognize a file.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression.
|
||||||
|
|
||||||
|
How it works:
|
||||||
|
|
||||||
|
For files which are not ELF and not a script for a known "-c" shell,
|
||||||
|
UPX uses kernel execve(), which first requires decompressing to a
|
||||||
|
temporary file in the file system. Interestingly -
|
||||||
|
because of the good memory management of the Linux kernel - this
|
||||||
|
often does not introduce a noticeable delay, and in fact there
|
||||||
|
will be no disk access at all if you have enough free memory as
|
||||||
|
the entire process takes places within the file system buffers.
|
||||||
|
|
||||||
|
A compressed executable consists of the UPX stub and an overlay
|
||||||
|
which contains the original program in a compressed form.
|
||||||
|
|
||||||
|
The UPX stub is a statically linked ELF executable and does
|
||||||
|
the following at program startup:
|
||||||
|
|
||||||
|
1) decompress the overlay to a temporary location in /tmp
|
||||||
|
2) open the temporary file for reading
|
||||||
|
3) try to delete the temporary file and start (execve)
|
||||||
|
the uncompressed program in /tmp using /proc/<pid>/fd/X as
|
||||||
|
attained by step 2)
|
||||||
|
4) if that fails, fork off a subprocess to clean up and
|
||||||
|
start the program in /tmp in the meantime
|
||||||
|
|
||||||
|
The UPX stub is about 1700 bytes long, partly written in assembler
|
||||||
|
and only uses kernel syscalls. It is not linked against any libc.
|
||||||
|
|
||||||
|
Specific drawbacks:
|
||||||
|
|
||||||
|
- You need additional free disk space for the uncompressed program
|
||||||
|
in your /tmp directory. This program is deleted immediately after
|
||||||
|
decompression, but you still need it for the full execution time
|
||||||
|
of the program.
|
||||||
|
|
||||||
|
- You must have /proc file system support as the stub wants to open
|
||||||
|
/proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
|
||||||
|
cannot compress programs that are used during the boot sequence
|
||||||
|
before /proc is mounted.
|
||||||
|
|
||||||
|
- Utilities like `top' will display numerical values in the process
|
||||||
|
name field. This is because Linux computes the process name from
|
||||||
|
the first argument of the last execve syscall (which is typically
|
||||||
|
something like /proc/<pid>/fd/3).
|
||||||
|
|
||||||
|
- Because of temporary decompression to disk the decompression speed
|
||||||
|
is not as fast as with the other executable formats. Still, I can see
|
||||||
|
no noticeable delay when starting programs like my ~3 MiB emacs (which
|
||||||
|
is less than 1 MiB when compressed :-).
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--force-execve Force the use of the generic linux/386 "execve"
|
||||||
|
format, i.e. do not try the linux/elf386 and
|
||||||
|
linux/sh386 formats.
|
||||||
|
|
||||||
|
NOTES FOR PS1/EXE
|
||||||
|
This is the executable format used by the Sony PlayStation (PSone), a
|
||||||
|
MIPS R3000 based gaming console which is popular since the late '90s.
|
||||||
|
Support of this format is very similar to the Atari one, because of
|
||||||
|
nostalgic feelings of one of the authors.
|
||||||
|
|
||||||
|
Packed programs will be byte-identical to the original after
|
||||||
|
uncompression, until further notice.
|
||||||
|
|
||||||
|
Maximum uncompressed size: ~1.89 / ~7.60 MiB.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- UPX creates as default a suitable executable for CD-Mastering
|
||||||
|
and console transfer. For a CD-Master main executable you could also try
|
||||||
|
the special option "--boot-only" as described below.
|
||||||
|
It has been reported that upx packed executables are fully compatible with
|
||||||
|
the Sony PlayStation 2 (PS2, PStwo) and Sony PlayStation Portable (PSP) in
|
||||||
|
Sony PlayStation (PSone) emulation mode.
|
||||||
|
|
||||||
|
- Normally the packed files use the same memory areas like the uncompressed
|
||||||
|
versions, so they will not override other memory areas while unpacking.
|
||||||
|
If this isn't possible UPX will abort showing a 'packed data overlap'
|
||||||
|
error. With the "--force" option UPX will relocate the loading address
|
||||||
|
for the packed file, but this isn't a real problem if it is a single or
|
||||||
|
the main executable.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--8-bit Uses 8 bit size compression [default: 32 bit]
|
||||||
|
|
||||||
|
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]
|
||||||
|
|
||||||
|
--boot-only This format is for main exes and CD-Mastering only !
|
||||||
|
It may slightly improve the compression ratio,
|
||||||
|
decompression routines are faster than default ones.
|
||||||
|
But it cannot be used for console transfer !
|
||||||
|
|
||||||
|
--no-align This option disables CD mode 2 data sector format
|
||||||
|
alignment. May slightly improves the compression ratio,
|
||||||
|
but the compressed executable will not boot from a CD.
|
||||||
|
Use it for console transfer only !
|
||||||
|
|
||||||
|
NOTES FOR RTM32/PE and ARM/PE
|
||||||
|
Same as win32/pe.
|
||||||
|
|
||||||
|
NOTES FOR TMT/ADAM
|
||||||
|
This format is used by the TMT Pascal compiler - see http://www.tmt.com/
|
||||||
|
.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR VMLINUZ/386
|
||||||
|
The vmlinuz/386 and bvmlinuz/386 formats take a gzip-compressed bootable
|
||||||
|
Linux kernel image ("vmlinuz", "zImage", "bzImage"), gzip-decompress it
|
||||||
|
and re-compress it with the UPX compression method.
|
||||||
|
|
||||||
|
vmlinuz/386 is completely unrelated to the other Linux executable
|
||||||
|
formats, and it does not share any of their drawbacks.
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
- Be sure that "vmlinuz/386" or "bvmlinuz/386" is displayed
|
||||||
|
during compression - otherwise a wrong executable format
|
||||||
|
may have been used, and the kernel won't boot.
|
||||||
|
|
||||||
|
Benefits:
|
||||||
|
|
||||||
|
- Better compression (but note that the kernel was already compressed,
|
||||||
|
so the improvement is not as large as with other formats).
|
||||||
|
Still, the bytes saved may be essential for special needs like
|
||||||
|
boot disks.
|
||||||
|
|
||||||
|
For example, this is what I get for my 2.2.16 kernel:
|
||||||
|
1589708 vmlinux
|
||||||
|
641073 bzImage [original]
|
||||||
|
560755 bzImage.upx [compressed by "upx -9"]
|
||||||
|
|
||||||
|
- Much faster decompression at kernel boot time (but kernel
|
||||||
|
decompression speed is not really an issue these days).
|
||||||
|
|
||||||
|
Drawbacks:
|
||||||
|
|
||||||
|
(none)
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
NOTES FOR WATCOM/LE
|
||||||
|
UPX has been successfully tested with the following extenders: DOS4G,
|
||||||
|
DOS4GW, PMODE/W, DOS32a, CauseWay. The WDOS/X extender is partly
|
||||||
|
supported (for details see the file bugs BUGS).
|
||||||
|
|
||||||
|
DLLs and the LX format are not supported.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--le Produce an unbound LE output instead of
|
||||||
|
keeping the current stub.
|
||||||
|
|
||||||
|
NOTES FOR WIN32/PE
|
||||||
|
The PE support in UPX is quite stable now, but probably there are still
|
||||||
|
some incompatibilities with some files.
|
||||||
|
|
||||||
|
Because of the way UPX (and other packers for this format) works, you
|
||||||
|
can see increased memory usage of your compressed files because the
|
||||||
|
whole program is loaded into memory at startup. If you start several
|
||||||
|
instances of huge compressed programs you're wasting memory because the
|
||||||
|
common segments of the program won't get shared across the instances. On
|
||||||
|
the other hand if you're compressing only smaller programs, or running
|
||||||
|
only one instance of larger programs, then this penalty is smaller, but
|
||||||
|
it's still there.
|
||||||
|
|
||||||
|
If you're running executables from network, then compressed programs
|
||||||
|
will load faster, and require less bandwidth during execution.
|
||||||
|
|
||||||
|
DLLs are supported. But UPX compressed DLLs can not share common data
|
||||||
|
and code when they got used by multiple applications. So compressing
|
||||||
|
msvcrt.dll is a waste of memory, but compressing the dll plugins of a
|
||||||
|
particular application may be a better idea.
|
||||||
|
|
||||||
|
Screensavers are supported, with the restriction that the filename must
|
||||||
|
end with ".scr" (as screensavers are handled slightly different than
|
||||||
|
normal exe files).
|
||||||
|
|
||||||
|
UPX compressed PE files have some minor memory overhead (usually in the
|
||||||
|
10 - 30 KiB range) which can be seen by specifying the "-i" command line
|
||||||
|
switch during compression.
|
||||||
|
|
||||||
|
Extra options available for this executable format:
|
||||||
|
|
||||||
|
--compress-exports=0 Don't compress the export section.
|
||||||
|
Use this if you plan to run the compressed
|
||||||
|
program under Wine.
|
||||||
|
--compress-exports=1 Compress the export section. [DEFAULT]
|
||||||
|
Compression of the export section can improve the
|
||||||
|
compression ratio quite a bit but may not work
|
||||||
|
with all programs (like winword.exe).
|
||||||
|
UPX never compresses the export section of a DLL
|
||||||
|
regardless of this option.
|
||||||
|
|
||||||
|
--compress-icons=0 Don't compress any icons.
|
||||||
|
--compress-icons=1 Compress all but the first icon.
|
||||||
|
--compress-icons=2 Compress all icons which are not in the
|
||||||
|
first icon directory. [DEFAULT]
|
||||||
|
--compress-icons=3 Compress all icons.
|
||||||
|
|
||||||
|
--compress-resources=0 Don't compress any resources at all.
|
||||||
|
|
||||||
|
--keep-resource=list Don't compress resources specified by the list.
|
||||||
|
The members of the list are separated by commas.
|
||||||
|
A list member has the following format: I<type[/name]>.
|
||||||
|
I<Type> is the type of the resource. Standard types
|
||||||
|
must be specified as decimal numbers, user types can be
|
||||||
|
specified by decimal IDs or strings. I<Name> is the
|
||||||
|
identifier of the resource. It can be a decimal number
|
||||||
|
or a string. For example:
|
||||||
|
|
||||||
|
--keep-resource=2/MYBITMAP,5,6/12345
|
||||||
|
|
||||||
|
UPX won't compress the named bitmap resource "MYBITMAP",
|
||||||
|
it leaves every dialog (5) resource uncompressed, and
|
||||||
|
it won't touch the string table resource with identifier
|
||||||
|
12345.
|
||||||
|
|
||||||
|
--force Force compression even when there is an
|
||||||
|
unexpected value in a header field.
|
||||||
|
Use with care.
|
||||||
|
|
||||||
|
--strip-relocs=0 Don't strip relocation records.
|
||||||
|
--strip-relocs=1 Strip relocation records. [DEFAULT]
|
||||||
|
This option only works on executables with base
|
||||||
|
address greater or equal to 0x400000. Usually the
|
||||||
|
compressed files becomes smaller, but some files
|
||||||
|
may become larger. Note that the resulting file will
|
||||||
|
not work under Windows 3.x (Win32s).
|
||||||
|
UPX never strips relocations from a DLL
|
||||||
|
regardless of this option.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
DIAGNOSTICS
|
||||||
|
Exit status is normally 0; if an error occurs, exit status is 1. If a
|
||||||
|
warning occurs, exit status is 2.
|
||||||
|
|
||||||
|
UPX's diagnostics are intended to be self-explanatory.
|
||||||
|
|
||||||
|
BUGS
|
||||||
|
Please report all bugs immediately to the authors.
|
||||||
|
|
||||||
|
AUTHORS
|
||||||
|
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com
|
||||||
|
|
||||||
|
Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
|
Jens Medoch <jssg@users.sourceforge.net>
|
||||||
|
|
||||||
|
COPYRIGHT
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
|
||||||
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
|
|
||||||
|
Copyright (C) 2002-2022 Jens Medoch
|
||||||
|
|
||||||
|
This program may be used freely, and you are welcome to redistribute it
|
||||||
|
under certain conditions.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
UPX is distributed with full source code under the terms of the GNU
|
||||||
|
General Public License v2+; either under the pure GPLv2+ (see the file
|
||||||
|
COPYING), or (at your option) under the GPLv+2 with special exceptions
|
||||||
|
and restrictions granting the free usage for commercial programs (see
|
||||||
|
the file LICENSE).
|
||||||
|
|
||||||
|
You should have received a copy of the UPX License Agreements along with
|
||||||
|
this program; see the files COPYING and LICENSE. If not, visit the UPX
|
||||||
|
home page.
|
||||||
|
|
||||||
+124
-115
@@ -13,8 +13,8 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
|||||||
=head1 ABSTRACT
|
=head1 ABSTRACT
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2006 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
https://upx.github.io
|
||||||
|
|
||||||
|
|
||||||
B<UPX> is a portable, extendable, high-performance executable packer for
|
B<UPX> is a portable, extendable, high-performance executable packer for
|
||||||
@@ -23,74 +23,59 @@ ratio and offers I<*very*> fast decompression. Your executables suffer
|
|||||||
no memory overhead or other drawbacks for most of the formats supported,
|
no memory overhead or other drawbacks for most of the formats supported,
|
||||||
because of in-place decompression.
|
because of in-place decompression.
|
||||||
|
|
||||||
While you may use B<UPX> freely for both non-commercial and commercial
|
|
||||||
executables (for details see the file LICENSE), we would highly
|
|
||||||
appreciate if you credit B<UPX> and ourselves in the documentation,
|
|
||||||
possibly including a reference to the B<UPX> home page. Thanks.
|
|
||||||
|
|
||||||
[ Using B<UPX> in non-OpenSource applications without proper credits
|
|
||||||
is considered not politically correct ;-) ]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head1 DISCLAIMER
|
=head1 DISCLAIMER
|
||||||
|
|
||||||
B<UPX> comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
|
B<UPX> comes with ABSOLUTELY NO WARRANTY; for details see the file COPYING.
|
||||||
|
|
||||||
This is the first production quality release, and we plan that future 1.xx
|
|
||||||
releases will be backward compatible with this version.
|
|
||||||
|
|
||||||
Please report all problems or suggestions to the authors. Thanks.
|
Please report all problems or suggestions to the authors. Thanks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
=head1 SECURITY CONTEXT
|
||||||
|
|
||||||
|
IMPORTANT NOTE: B<UPX> inherits the security context of any files it handles.
|
||||||
|
|
||||||
|
This means that packing, unpacking, or even testing or listing a file requires
|
||||||
|
the same security considerations as actually executing the file.
|
||||||
|
|
||||||
|
Use B<UPX> on trusted files only!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
B<UPX> is a versatile executable packer with the following features:
|
B<UPX> is a versatile executable packer with the following features:
|
||||||
|
|
||||||
- excellent compression ratio: compresses better than zip/gzip,
|
- secure: as UPX is documented Open Source since many years any relevant
|
||||||
|
Security/Antivirus software is able to peek inside UPX compressed
|
||||||
|
apps to verify them
|
||||||
|
|
||||||
|
- excellent compression ratio: typically compresses better than Zip,
|
||||||
use UPX to decrease the size of your distribution !
|
use UPX to decrease the size of your distribution !
|
||||||
|
|
||||||
- very fast decompression: about 10 MB/sec on an ancient Pentium 133,
|
- very fast decompression: more than 500 MB/sec on any reasonably modern
|
||||||
about 200 MB/sec on an Athlon XP 2000+.
|
machine
|
||||||
|
|
||||||
- no memory overhead for your compressed executables for most of the
|
- no memory overhead for your compressed executables for most of the
|
||||||
supported formats
|
supported formats because of in-place decompression
|
||||||
|
|
||||||
- safe: you can list, test and unpack your executables
|
- safe: you can list, test and unpack your executables.
|
||||||
Also, a checksum of both the compressed and uncompressed file is
|
Also, a checksum of both the compressed and uncompressed file is
|
||||||
maintained internally.
|
maintained internally.
|
||||||
|
|
||||||
- universal: UPX can pack a number of executable formats:
|
- universal: UPX can pack a number of executable formats, including
|
||||||
* atari/tos
|
Windows programs and DLLs, macOS apps and Linux executables
|
||||||
* bvmlinuz/386 [bootable Linux kernel]
|
|
||||||
* djgpp2/coff
|
|
||||||
* dos/com
|
|
||||||
* dos/exe
|
|
||||||
* dos/sys
|
|
||||||
* linux/386
|
|
||||||
* linux/elf386
|
|
||||||
* linux/sh386
|
|
||||||
* ps1/exe
|
|
||||||
* rtm32/pe
|
|
||||||
* tmt/adam
|
|
||||||
* vmlinuz/386 [bootable Linux kernel]
|
|
||||||
* vmlinux/386
|
|
||||||
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
|
|
||||||
* win32/pe (exe and dll)
|
|
||||||
* arm/pe (exe and dll)
|
|
||||||
* linux/elfamd64
|
|
||||||
* linux/elfppc32
|
|
||||||
* mach/elfppc32
|
|
||||||
|
|
||||||
- portable: UPX is written in portable endian-neutral C++
|
- portable: UPX is written in portable endian-neutral C++
|
||||||
|
|
||||||
- extendable: because of the class layout it's very easy to support
|
- extendable: because of the class layout it's very easy to support
|
||||||
new executable formats or add new compression algorithms
|
new executable formats or add new compression algorithms
|
||||||
|
|
||||||
- free: UPX can be distributed and used freely. And from version 0.99
|
- free: UPX is distributed with full source code under the GNU General
|
||||||
the full source code of UPX is released under the GNU General Public
|
Public License v2+, with special exceptions granting the free usage
|
||||||
License (GPL) !
|
for commercial programs
|
||||||
|
|
||||||
You probably understand now why we call B<UPX> the "I<ultimate>"
|
You probably understand now why we call B<UPX> the "I<ultimate>"
|
||||||
executable packer.
|
executable packer.
|
||||||
@@ -138,7 +123,18 @@ B<--help>: prints the help
|
|||||||
|
|
||||||
B<--version>: print the version of B<UPX>
|
B<--version>: print the version of B<UPX>
|
||||||
|
|
||||||
[ ...to be written... - type `B<upx --help>' for now ]
|
B<--exact>: when compressing, require to be able to get a byte-identical file
|
||||||
|
after decompression with option B<-d>. [NOTE: this is work in progress and is
|
||||||
|
not supported for all formats yet. If you do care, as a workaround you can
|
||||||
|
compress and then decompress your program a first time - any further
|
||||||
|
compress-decompress steps should then yield byte-identical results
|
||||||
|
as compared to the first decompressed version.]
|
||||||
|
|
||||||
|
B<-k>: keep backup files
|
||||||
|
|
||||||
|
B<-o file>: write output to file
|
||||||
|
|
||||||
|
[ ...more docs need to be written... - type `B<upx --help>' for now ]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -146,7 +142,7 @@ B<--version>: print the version of B<UPX>
|
|||||||
|
|
||||||
B<UPX> offers ten different compression levels from B<-1> to B<-9>,
|
B<UPX> offers ten different compression levels from B<-1> to B<-9>,
|
||||||
and B<--best>. The default compression level is B<-8> for files
|
and B<--best>. The default compression level is B<-8> for files
|
||||||
smaller than 512 kB, and B<-7> otherwise.
|
smaller than 512 KiB, and B<-7> otherwise.
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
@@ -172,38 +168,23 @@ Note that compression level B<--best> can be somewhat slow for large
|
|||||||
files, but you definitely should use it when releasing a final version
|
files, but you definitely should use it when releasing a final version
|
||||||
of your program.
|
of your program.
|
||||||
|
|
||||||
Quick start for achieving the best compression ratio:
|
Quick info for achieving the best compression ratio:
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
Try B<upx --brute myfile.exe>.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
Details for achieving the best compression ratio:
|
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
Use the compression level B<--best>.
|
Try B<upx --brute --no-lzma myfile.exe> or even
|
||||||
|
B<upx --ultra-brute --no-lzma myfile.exe>.
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
Try one or both of the options B<--all-methods> and B<--all-filters>.
|
The option B<--lzma> enables LZMA compression, which compresses better but
|
||||||
|
is *significantly slower* at decompression. You probably do not want
|
||||||
|
to use it for large files.
|
||||||
|
|
||||||
=item *
|
(Note that B<--lzma> is automatically enabled by B<--all-methods> and
|
||||||
|
B<--brute>, use B<--no-lzma> to override.)
|
||||||
Try the option B<--crp-ms=NUMBER>. This uses more memory during compression
|
|
||||||
to achieve a (slightly) better compression ratio.
|
|
||||||
|
|
||||||
NUMBER must be a decimal value from 10000 to 999999, inclusive.
|
|
||||||
The default value is 10000 (ten thousand).
|
|
||||||
|
|
||||||
=item *
|
|
||||||
|
|
||||||
Info: the option B<--brute> is an abbrevation for the options
|
|
||||||
B<S<--best> S<--all-methods> S<--all-filters> S<--crp-ms=999999>>.
|
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
@@ -219,7 +200,7 @@ For win32/pe programs there's B<--strip-relocs=0>. See notes below.
|
|||||||
|
|
||||||
=head1 OVERLAY HANDLING OPTIONS
|
=head1 OVERLAY HANDLING OPTIONS
|
||||||
|
|
||||||
Info: An "overlay" means auxillary data atached after the logical end of
|
Info: An "overlay" means auxiliary data attached after the logical end of
|
||||||
an executable, and it often contains application specific data
|
an executable, and it often contains application specific data
|
||||||
(this is a common practice to avoid an extra data file, though
|
(this is a common practice to avoid an extra data file, though
|
||||||
it would be better to use resource sections).
|
it would be better to use resource sections).
|
||||||
@@ -239,7 +220,7 @@ actually accesses this overlayed data.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head1 ENVIRONMENT
|
=head1 ENVIRONMENT VARIABLE
|
||||||
|
|
||||||
The environment variable B<UPX> can hold a set of default
|
The environment variable B<UPX> can hold a set of default
|
||||||
options for B<UPX>. These options are interpreted first and
|
options for B<UPX>. These options are interpreted first and
|
||||||
@@ -269,7 +250,7 @@ This is the executable format used by the Atari ST/TT, a Motorola 68000
|
|||||||
based personal computer which was popular in the late '80s. Support
|
based personal computer which was popular in the late '80s. Support
|
||||||
of this format is only because of nostalgic feelings of one of
|
of this format is only because of nostalgic feelings of one of
|
||||||
the authors and serves no practical purpose :-).
|
the authors and serves no practical purpose :-).
|
||||||
See http://www.freemint.de for more info.
|
See https://freemint.github.io for more info.
|
||||||
|
|
||||||
Packed programs will be byte-identical to the original after uncompression.
|
Packed programs will be byte-identical to the original after uncompression.
|
||||||
All debug information will be stripped, though.
|
All debug information will be stripped, though.
|
||||||
@@ -340,9 +321,6 @@ Extra options available for this executable format:
|
|||||||
|
|
||||||
=head2 NOTES FOR DOS/SYS
|
=head2 NOTES FOR DOS/SYS
|
||||||
|
|
||||||
You can only compress plain sys files, sys/exe (two in one)
|
|
||||||
combos are not supported.
|
|
||||||
|
|
||||||
Compressed programs only work on a 286+.
|
Compressed programs only work on a 286+.
|
||||||
|
|
||||||
Packed programs will be byte-identical to the original after uncompression.
|
Packed programs will be byte-identical to the original after uncompression.
|
||||||
@@ -370,7 +348,7 @@ Extra options available for this executable format:
|
|||||||
First of all, it is recommended to use B<UPX> *instead* of B<strip>. strip has
|
First of all, it is recommended to use B<UPX> *instead* of B<strip>. strip has
|
||||||
the very bad habit of replacing your stub with its own (outdated) version.
|
the very bad habit of replacing your stub with its own (outdated) version.
|
||||||
Additionally B<UPX> corrects a bug/feature in strip v2.8.x: it
|
Additionally B<UPX> corrects a bug/feature in strip v2.8.x: it
|
||||||
will fix the 4 KByte aligment of the stub.
|
will fix the 4 KiB alignment of the stub.
|
||||||
|
|
||||||
B<UPX> includes the full functionality of stubify. This means it will
|
B<UPX> includes the full functionality of stubify. This means it will
|
||||||
automatically stubify your COFF files. Use the option B<--coff> to
|
automatically stubify your COFF files. Use the option B<--coff> to
|
||||||
@@ -405,7 +383,7 @@ Extra options available for this executable format:
|
|||||||
Introduction
|
Introduction
|
||||||
|
|
||||||
Linux/386 support in UPX consists of 3 different executable formats,
|
Linux/386 support in UPX consists of 3 different executable formats,
|
||||||
one optimized for ELF excutables ("linux/elf386"), one optimized
|
one optimized for ELF executables ("linux/elf386"), one optimized
|
||||||
for shell scripts ("linux/sh386"), and one generic format
|
for shell scripts ("linux/sh386"), and one generic format
|
||||||
("linux/386").
|
("linux/386").
|
||||||
|
|
||||||
@@ -433,14 +411,14 @@ General user's overview
|
|||||||
or network I/O.
|
or network I/O.
|
||||||
|
|
||||||
Depending on the statistics of usage and access, and the relative
|
Depending on the statistics of usage and access, and the relative
|
||||||
speeds of CPU, RAM, swap space, /tmp, and filesystem storage, then
|
speeds of CPU, RAM, swap space, /tmp, and file system storage, then
|
||||||
invoking and running a compressed executable can be faster than
|
invoking and running a compressed executable can be faster than
|
||||||
directly running the corresponding uncompressed program.
|
directly running the corresponding uncompressed program.
|
||||||
The operating system might perfrom fewer expensive I/O operations
|
The operating system might perform fewer expensive I/O operations
|
||||||
to invoke the compressed program. Paging to or from swap space
|
to invoke the compressed program. Paging to or from swap space
|
||||||
or /tmp might be faster than paging from the general filesystem.
|
or /tmp might be faster than paging from the general file system.
|
||||||
``Medium-sized'' programs which access about 1/3 to 1/2 of their
|
``Medium-sized'' programs which access about 1/3 to 1/2 of their
|
||||||
stored program bytes can do particulary well with compression.
|
stored program bytes can do particularly well with compression.
|
||||||
Small programs tend not to benefit as much because the absolute
|
Small programs tend not to benefit as much because the absolute
|
||||||
savings is less. Big programs tend not to benefit proportionally
|
savings is less. Big programs tend not to benefit proportionally
|
||||||
because each invocation may use only a small fraction of the program,
|
because each invocation may use only a small fraction of the program,
|
||||||
@@ -449,7 +427,7 @@ General user's overview
|
|||||||
then compression may win anyway.
|
then compression may win anyway.
|
||||||
|
|
||||||
Currently, executables compressed by UPX do not share RAM at runtime
|
Currently, executables compressed by UPX do not share RAM at runtime
|
||||||
in the way that executables mapped from a filesystem do. As a
|
in the way that executables mapped from a file system do. As a
|
||||||
result, if the same program is run simultaneously by more than one
|
result, if the same program is run simultaneously by more than one
|
||||||
process, then using the compressed version will require more RAM and/or
|
process, then using the compressed version will require more RAM and/or
|
||||||
swap space. So, shell programs (bash, csh, etc.) and ``make''
|
swap space. So, shell programs (bash, csh, etc.) and ``make''
|
||||||
@@ -538,7 +516,7 @@ The linux/elf386 format decompresses directly into RAM,
|
|||||||
uses only one exec, does not use space in /tmp,
|
uses only one exec, does not use space in /tmp,
|
||||||
and does not use /proc.
|
and does not use /proc.
|
||||||
|
|
||||||
Linux/elf386 is automatically selected for Linux ELF exectuables.
|
Linux/elf386 is automatically selected for Linux ELF executables.
|
||||||
|
|
||||||
Packed programs will be byte-identical to the original after uncompression.
|
Packed programs will be byte-identical to the original after uncompression.
|
||||||
|
|
||||||
@@ -627,7 +605,7 @@ Extra options available for this executable format:
|
|||||||
Please read the general Linux description first.
|
Please read the general Linux description first.
|
||||||
|
|
||||||
The generic linux/386 format decompresses to /tmp and needs
|
The generic linux/386 format decompresses to /tmp and needs
|
||||||
/proc filesystem support. It starts the decompressed program
|
/proc file system support. It starts the decompressed program
|
||||||
via the execve() syscall.
|
via the execve() syscall.
|
||||||
|
|
||||||
Linux/386 is only selected if the specialized linux/elf386
|
Linux/386 is only selected if the specialized linux/elf386
|
||||||
@@ -639,11 +617,11 @@ How it works:
|
|||||||
|
|
||||||
For files which are not ELF and not a script for a known "-c" shell,
|
For files which are not ELF and not a script for a known "-c" shell,
|
||||||
UPX uses kernel execve(), which first requires decompressing to a
|
UPX uses kernel execve(), which first requires decompressing to a
|
||||||
temporary file in the filesystem. Interestingly -
|
temporary file in the file system. Interestingly -
|
||||||
because of the good memory management of the Linux kernel - this
|
because of the good memory management of the Linux kernel - this
|
||||||
often does not introduce a noticable delay, and in fact there
|
often does not introduce a noticeable delay, and in fact there
|
||||||
will be no disk access at all if you have enough free memory as
|
will be no disk access at all if you have enough free memory as
|
||||||
the entire process takes places within the filesystem buffers.
|
the entire process takes places within the file system buffers.
|
||||||
|
|
||||||
A compressed executable consists of the UPX stub and an overlay
|
A compressed executable consists of the UPX stub and an overlay
|
||||||
which contains the original program in a compressed form.
|
which contains the original program in a compressed form.
|
||||||
@@ -669,7 +647,7 @@ Specific drawbacks:
|
|||||||
decompression, but you still need it for the full execution time
|
decompression, but you still need it for the full execution time
|
||||||
of the program.
|
of the program.
|
||||||
|
|
||||||
- You must have /proc filesystem support as the stub wants to open
|
- You must have /proc file system support as the stub wants to open
|
||||||
/proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
|
/proc/<pid>/exe and needs /proc/<pid>/fd/X. This also means that you
|
||||||
cannot compress programs that are used during the boot sequence
|
cannot compress programs that are used during the boot sequence
|
||||||
before /proc is mounted.
|
before /proc is mounted.
|
||||||
@@ -681,8 +659,8 @@ Specific drawbacks:
|
|||||||
|
|
||||||
- Because of temporary decompression to disk the decompression speed
|
- Because of temporary decompression to disk the decompression speed
|
||||||
is not as fast as with the other executable formats. Still, I can see
|
is not as fast as with the other executable formats. Still, I can see
|
||||||
no noticable delay when starting programs like my ~3 MB emacs (which
|
no noticeable delay when starting programs like my ~3 MiB emacs (which
|
||||||
is less than 1 MB when compressed :-).
|
is less than 1 MiB when compressed :-).
|
||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
|
|
||||||
@@ -695,26 +673,30 @@ Extra options available for this executable format:
|
|||||||
=head2 NOTES FOR PS1/EXE
|
=head2 NOTES FOR PS1/EXE
|
||||||
|
|
||||||
This is the executable format used by the Sony PlayStation (PSone),
|
This is the executable format used by the Sony PlayStation (PSone),
|
||||||
a Mips R3000 based gaming console which is popular since the late '90s.
|
a MIPS R3000 based gaming console which is popular since the late '90s.
|
||||||
Support of this format is very similar to the Atari one, because of
|
Support of this format is very similar to the Atari one, because of
|
||||||
nostalgic feelings of one of the authors.
|
nostalgic feelings of one of the authors.
|
||||||
|
|
||||||
Packed programs will be byte-identical to the original after uncompression,
|
Packed programs will be byte-identical to the original after uncompression,
|
||||||
until further notice.
|
until further notice.
|
||||||
|
|
||||||
Maximum uncompressed size: ~1998848 bytes.
|
Maximum uncompressed size: ~1.89 / ~7.60 MiB.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
- UPX creates as default a 'CD-Rom only' PS1/PS2 compatible executable.
|
- UPX creates as default a suitable executable for CD-Mastering
|
||||||
For transfer between client/target use options below.
|
and console transfer. For a CD-Master main executable you could also try
|
||||||
|
the special option "--boot-only" as described below.
|
||||||
|
It has been reported that upx packed executables are fully compatible with
|
||||||
|
the Sony PlayStation 2 (PS2, PStwo) and Sony PlayStation Portable (PSP) in
|
||||||
|
Sony PlayStation (PSone) emulation mode.
|
||||||
|
|
||||||
- Normally the packed files use the same memory areas like the uncompressed
|
- Normally the packed files use the same memory areas like the uncompressed
|
||||||
versions, so they will not override other memory areas while unpacking.
|
versions, so they will not override other memory areas while unpacking.
|
||||||
If this isn't possible UPX will abort showing a 'packed data overlap'
|
If this isn't possible UPX will abort showing a 'packed data overlap'
|
||||||
error. With the "--force" option UPX will set a few 'bytes higher' loading
|
error. With the "--force" option UPX will relocate the loading address
|
||||||
offset for the packed file, but this isn't a real problem if it is a
|
for the packed file, but this isn't a real problem if it is a single or
|
||||||
single or boot-only executable.
|
the main executable.
|
||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
|
|
||||||
@@ -723,15 +705,19 @@ Extra options available for this executable format:
|
|||||||
the compression ratio in some cases, but usually
|
the compression ratio in some cases, but usually
|
||||||
the default method gives the best results anyway.
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
--boot-only The format will only run from a CD and may slightly
|
--8-bit Uses 8 bit size compression [default: 32 bit]
|
||||||
improves the compression ratio. The decompression
|
|
||||||
routines are faster than default ones.
|
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]
|
||||||
But it cannot be used for host/client transfer !
|
|
||||||
|
--boot-only This format is for main exes and CD-Mastering only !
|
||||||
|
It may slightly improve the compression ratio,
|
||||||
|
decompression routines are faster than default ones.
|
||||||
|
But it cannot be used for console transfer !
|
||||||
|
|
||||||
--no-align This option disables CD mode 2 data sector format
|
--no-align This option disables CD mode 2 data sector format
|
||||||
alignment. May slightly improves the compression ratio,
|
alignment. May slightly improves the compression ratio,
|
||||||
but the compressed executable will not boot from a CD.
|
but the compressed executable will not boot from a CD.
|
||||||
Use it for client/target transfer only !
|
Use it for console transfer only !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -779,7 +765,7 @@ Benefits:
|
|||||||
- Better compression (but note that the kernel was already compressed,
|
- Better compression (but note that the kernel was already compressed,
|
||||||
so the improvement is not as large as with other formats).
|
so the improvement is not as large as with other formats).
|
||||||
Still, the bytes saved may be essential for special needs like
|
Still, the bytes saved may be essential for special needs like
|
||||||
bootdisks.
|
boot disks.
|
||||||
|
|
||||||
For example, this is what I get for my 2.2.16 kernel:
|
For example, this is what I get for my 2.2.16 kernel:
|
||||||
1589708 vmlinux
|
1589708 vmlinux
|
||||||
@@ -826,13 +812,13 @@ Extra options available for this executable format:
|
|||||||
=head2 NOTES FOR WIN32/PE
|
=head2 NOTES FOR WIN32/PE
|
||||||
|
|
||||||
The PE support in B<UPX> is quite stable now, but probably there are
|
The PE support in B<UPX> is quite stable now, but probably there are
|
||||||
still some incompabilities with some files.
|
still some incompatibilities with some files.
|
||||||
|
|
||||||
Because of the way B<UPX> (and other packers for this format) works, you
|
Because of the way B<UPX> (and other packers for this format) works, you
|
||||||
can see increased memory usage of your compressed files because the whole
|
can see increased memory usage of your compressed files because the whole
|
||||||
program is loaded into memory at startup.
|
program is loaded into memory at startup.
|
||||||
If you start several instances of huge compressed programs you're
|
If you start several instances of huge compressed programs you're
|
||||||
wasting memory because the common segements of the program won't
|
wasting memory because the common segments of the program won't
|
||||||
get shared across the instances.
|
get shared across the instances.
|
||||||
On the other hand if you're compressing only smaller programs, or
|
On the other hand if you're compressing only smaller programs, or
|
||||||
running only one instance of larger programs, then this penalty is
|
running only one instance of larger programs, then this penalty is
|
||||||
@@ -850,8 +836,8 @@ Screensavers are supported, with the restriction that the filename
|
|||||||
must end with ".scr" (as screensavers are handled slightly different
|
must end with ".scr" (as screensavers are handled slightly different
|
||||||
than normal exe files).
|
than normal exe files).
|
||||||
|
|
||||||
UPX compressed PE files has some minor memory overhead (usually in the
|
UPX compressed PE files have some minor memory overhead (usually in the
|
||||||
10 - 30 kbytes range) which can be seen by specifying the "-i" command
|
10 - 30 KiB range) which can be seen by specifying the "-i" command
|
||||||
line switch during compression.
|
line switch during compression.
|
||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
@@ -870,9 +856,26 @@ Extra options available for this executable format:
|
|||||||
--compress-icons=1 Compress all but the first icon.
|
--compress-icons=1 Compress all but the first icon.
|
||||||
--compress-icons=2 Compress all icons which are not in the
|
--compress-icons=2 Compress all icons which are not in the
|
||||||
first icon directory. [DEFAULT]
|
first icon directory. [DEFAULT]
|
||||||
|
--compress-icons=3 Compress all icons.
|
||||||
|
|
||||||
--compress-resources=0 Don't compress any resources at all.
|
--compress-resources=0 Don't compress any resources at all.
|
||||||
|
|
||||||
|
--keep-resource=list Don't compress resources specified by the list.
|
||||||
|
The members of the list are separated by commas.
|
||||||
|
A list member has the following format: I<type[/name]>.
|
||||||
|
I<Type> is the type of the resource. Standard types
|
||||||
|
must be specified as decimal numbers, user types can be
|
||||||
|
specified by decimal IDs or strings. I<Name> is the
|
||||||
|
identifier of the resource. It can be a decimal number
|
||||||
|
or a string. For example:
|
||||||
|
|
||||||
|
--keep-resource=2/MYBITMAP,5,6/12345
|
||||||
|
|
||||||
|
UPX won't compress the named bitmap resource "MYBITMAP",
|
||||||
|
it leaves every dialog (5) resource uncompressed, and
|
||||||
|
it won't touch the string table resource with identifier
|
||||||
|
12345.
|
||||||
|
|
||||||
--force Force compression even when there is an
|
--force Force compression even when there is an
|
||||||
unexpected value in a header field.
|
unexpected value in a header field.
|
||||||
Use with care.
|
Use with care.
|
||||||
@@ -919,7 +922,7 @@ Please report all bugs immediately to the authors.
|
|||||||
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
||||||
http://www.oberhumer.com
|
http://www.oberhumer.com
|
||||||
|
|
||||||
Laszlo Molnar <ml1050@users.sourceforge.net>
|
Laszlo Molnar <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser <jreiser@BitWagon.com>
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
|
||||||
@@ -929,22 +932,28 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2006 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2006 John F. Reiser
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2006 Jens Medoch
|
Copyright (C) 2002-2022 Jens Medoch
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
B<UPX License Agreement> for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the UPX License Agreement along
|
B<UPX> is distributed with full source code under the terms of the
|
||||||
with this program; see the file LICENSE. If not, visit the UPX home page.
|
GNU General Public License v2+;
|
||||||
|
either under the pure GPLv2+ (see the file COPYING),
|
||||||
|
or (at your option) under the GPLv+2 with special exceptions and
|
||||||
|
restrictions granting the free usage for commercial
|
||||||
|
programs (see the file LICENSE).
|
||||||
|
|
||||||
|
You should have received a copy of the UPX License Agreements along
|
||||||
|
with this program; see the files COPYING and LICENSE. If not,
|
||||||
|
visit the UPX home page.
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
||||||
|
|
||||||
|
# create the image from Dockerfile
|
||||||
|
# using a rootless Podman container
|
||||||
|
|
||||||
|
image=upx-stubtools-20210104-v5
|
||||||
|
|
||||||
|
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"
|
||||||
|
|
||||||
|
podman image list "$image"
|
||||||
|
podman image tree "$image"
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
||||||
|
|
||||||
|
# run an interactive shell in the image
|
||||||
|
# using a rootless Podman container
|
||||||
|
|
||||||
|
image=upx-stubtools-20210104-v5
|
||||||
|
|
||||||
|
flags=( -ti --read-only --rm )
|
||||||
|
flags+=( --cap-drop=all ) # drop all capabilities
|
||||||
|
flags+=( --network=none ) # no network needed
|
||||||
|
flags+=( -e TERM="$TERM" ) # pass $TERM
|
||||||
|
if [[ 1 == 1 ]]; then
|
||||||
|
# run as user upx 2000:2000
|
||||||
|
flags+=( --user 2000 )
|
||||||
|
# map container user 0 to subuid-user 1, and map container user 2000 to current host user
|
||||||
|
flags+=( --uidmap=0:1:1 --uidmap=2000:0:1 )
|
||||||
|
# map container group 0 to subgid-group 1, and map container group 2000 to current host group
|
||||||
|
flags+=( --gidmap=0:1:1 --gidmap=2000:0:1 )
|
||||||
|
# NOTE: we mount the upx top-level directory read-write under /home/upx/src/upx
|
||||||
|
# INFO: SELinux users *may* have to add ":z" to the volume mount flags; check the docs!
|
||||||
|
flags+=( -v "${argv0dir}/../..:/home/upx/src/upx" )
|
||||||
|
flags+=( -w /home/upx/src/upx ) # working directory
|
||||||
|
else
|
||||||
|
# run as user root 0:0
|
||||||
|
# ONLY FOR DEBUGGING THE IMAGE
|
||||||
|
# map container user/group 0 to current host user/group
|
||||||
|
flags+=( --user 0 )
|
||||||
|
fi
|
||||||
|
|
||||||
|
podman run "${flags[@]}" "$image" bash -l
|
||||||
|
|
||||||
|
# now we can rebuild the UPX stubs:
|
||||||
|
# cd /home/upx/src/upx/src/stub
|
||||||
|
# # make sure that git is clean:
|
||||||
|
# git status .
|
||||||
|
# # remove stub files and make sure that they got deleted:
|
||||||
|
# make maintainer-clean
|
||||||
|
# git status .
|
||||||
|
# # rebuild
|
||||||
|
# make all
|
||||||
|
# # make sure that the stub files did rebuild correctly:
|
||||||
|
# git status .
|
||||||
|
# git diff .
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
FROM docker.io/library/ubuntu:22.04
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
|
# install system packages
|
||||||
|
RUN dpkg --add-architecture i386 \
|
||||||
|
&& apt-get update && apt-get upgrade -y \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
aria2 ca-certificates git less libmpc3 libncurses5 make \
|
||||||
|
ncurses-term perl-base python2-minimal wget xz-utils \
|
||||||
|
libc6:i386 zlib1g:i386 \
|
||||||
|
# the following packages are not required for rebuilding the stubs,
|
||||||
|
# but they do make the image more convenient and also allow building
|
||||||
|
# the full UPX binary inside the container via CMake:
|
||||||
|
bzip2 cmake elfutils file g++ libzstd-dev lzop ninja-build patch \
|
||||||
|
patchelf pax-utils rsync unzip vim zip zlib1g-dev zsh zstd \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
# manually install compat libs from Ubuntu 16.04
|
||||||
|
RUN cd /root \
|
||||||
|
&& aria2c --checksum=sha-256=2605f43f8047fc972855bb909f1dd7af761bbfd35ae559ad689b0d55a4236d69 \
|
||||||
|
'http://mirror.enzu.com/ubuntu/pool/main/g/gmp/libgmp10_6.1.0+dfsg-2_amd64.deb' \
|
||||||
|
&& aria2c --checksum=sha-256=3973a97387bbe0e8a775995c22861d8478edee2a594e8117970f635de25b2c8a \
|
||||||
|
'http://mirror.enzu.com/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd64.deb' \
|
||||||
|
&& mkdir packages \
|
||||||
|
&& for f in ./*.deb; do dpkg -x $f ./packages; done \
|
||||||
|
&& mv -v -n ./packages/usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/ \
|
||||||
|
&& rm -rf ./*.deb ./packages \
|
||||||
|
&& ldconfig \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
# install upx-stubtools into /usr/local/bin/bin-upx-20210104
|
||||||
|
RUN cd /root \
|
||||||
|
&& aria2c --checksum=sha-256=abcd8337cc656fe68d7bbb2ffe0f1e5ddce618688aa0e18c1ebcc40072843884 \
|
||||||
|
'https://github.com/upx/upx-stubtools/releases/download/v20210104/bin-upx-20210104.tar.xz' \
|
||||||
|
&& cd /usr/local/bin \
|
||||||
|
&& tar -xoaf /root/bin-upx-20210104.tar.xz \
|
||||||
|
&& rm /root/bin-upx-20210104.tar.xz \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
# install previous UPX versions into /usr/local/bin
|
||||||
|
RUN cd /root \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.92/upx-3.92-amd64_linux.tar.xz \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.93/upx-3.93-amd64_linux.tar.xz \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.94/upx-3.94-amd64_linux.tar.xz \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz \
|
||||||
|
&& wget -q https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz \
|
||||||
|
&& for f in ./upx-*.tar.*; do tar -xoaf $f; done \
|
||||||
|
&& rm ./upx-*.tar.* \
|
||||||
|
&& d=upx-3.91-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.91 \
|
||||||
|
&& d=upx-3.92-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.92 \
|
||||||
|
&& d=upx-3.93-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.93 \
|
||||||
|
&& d=upx-3.94-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.94 \
|
||||||
|
&& d=upx-3.95-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.95 \
|
||||||
|
&& d=upx-3.96-amd64_linux; ./$d/upx -d $d/upx -o /usr/local/bin/upx-3.96 \
|
||||||
|
&& rm -rf ./upx-*linux \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
# create default user upx 2000:2000
|
||||||
|
RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
|
||||||
|
&& mkdir -p /home/upx/.local/bin /home/upx/src/upx \
|
||||||
|
&& ln -s /usr/local/bin/bin-upx-20210104 /home/upx/.local/bin/bin-upx \
|
||||||
|
&& chown -R upx:upx /home/upx \
|
||||||
|
&& true
|
||||||
|
USER upx
|
||||||
Executable
+39
@@ -0,0 +1,39 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
[[ -z $1 ]] || cd "$1" || exit 1
|
||||||
|
|
||||||
|
find . \
|
||||||
|
-type d -name '.git' -prune -o \
|
||||||
|
-type d -name '.hg' -prune -o \
|
||||||
|
-type d -name 'build*' -prune -o \
|
||||||
|
-type d -name 'tmp*' -prune -o \
|
||||||
|
-type d -name 'vendor' -prune -o \
|
||||||
|
-type f -iname '*.bat' -prune -o \
|
||||||
|
-type f -iname '*.exe' -prune -o \
|
||||||
|
-type f -iname '*.o' -prune -o \
|
||||||
|
-type f -iname '*.obj' -prune -o \
|
||||||
|
-type f -iname '*.out' -prune -o \
|
||||||
|
-type f -iname '*.pdf' -prune -o \
|
||||||
|
-type f -iname '*.swp' -prune -o \
|
||||||
|
-type f -print0 | \
|
||||||
|
LC_ALL=C sort -z | xargs -0r perl -n -e '
|
||||||
|
#print("$ARGV\n");
|
||||||
|
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||||
|
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||||
|
if (m,([ \t]+)$,) {
|
||||||
|
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
||||||
|
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
||||||
|
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m,\t,) {
|
||||||
|
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||||
|
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||||
|
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||||
|
else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); }
|
||||||
|
}
|
||||||
|
' || exit 1
|
||||||
Executable
+33
@@ -0,0 +1,33 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
[[ -z $1 ]] || cd "$1" || exit 1
|
||||||
|
[[ -d .git ]] || exit 1
|
||||||
|
|
||||||
|
git ls-files --full-name -z | perl -0 -n -e '
|
||||||
|
s,^,./,;
|
||||||
|
if (m,^\./src/lzma-sdk(\0|$),) { }
|
||||||
|
elsif (m,^\./vendor/,) { }
|
||||||
|
elsif (m,\.bat(\0|$),) { }
|
||||||
|
elsif (m,\.exe(\0|$),) { }
|
||||||
|
else { print; }
|
||||||
|
' | LC_ALL=C sort -z | xargs -0r perl -n -e '
|
||||||
|
#print("$ARGV\n");
|
||||||
|
if (m,[\x00\x01\x02\x7f\xfe\xff],) { print "ERROR: binary file detected $ARGV: $_"; exit(1); }
|
||||||
|
if (m,[\r\x1a],) { print "ERROR: DOS EOL detected $ARGV: $_"; exit(1); }
|
||||||
|
if (m,([ \t]+)$,) {
|
||||||
|
# allow exactly two trailing spaces for GitHub flavoured Markdown in .md files
|
||||||
|
if ($1 ne " " || $ARGV !~ m,\.md$,) {
|
||||||
|
print "ERROR: trailing whitespace detected $ARGV: $_"; exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m,\t,) {
|
||||||
|
if ($ARGV =~ m,(^|/)(gnu|m)?make(file|vars),i) { }
|
||||||
|
elsif ($ARGV =~ m,/tmp/.*\.(disasm|dump)$,) { }
|
||||||
|
elsif ($ARGV =~ m,/src/stub/src/arch/.*/lzma\w+\.S$,) { }
|
||||||
|
else { print "ERROR: hard TAB detected $ARGV: $_"; exit(1); }
|
||||||
|
}
|
||||||
|
' || exit 1
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#! /usr/bin/env bash
|
||||||
|
## vim:set ts=4 sw=4 et:
|
||||||
|
set -e; set -o pipefail
|
||||||
|
|
||||||
|
# "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." --Rob Pike
|
||||||
|
|
||||||
|
# NOTE: we are using clang-format-10.0.1 from upx-stubtools
|
||||||
|
# see https://github.com/upx/upx-stubtools/releases
|
||||||
|
|
||||||
|
# NOTE: we use .clang-format config from upx.git/.clang-format
|
||||||
|
|
||||||
|
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||||
|
UPX_CLANG_FORMAT="$HOME/local/bin/bin-upx/clang-format-10.0.1"
|
||||||
|
fi
|
||||||
|
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||||
|
UPX_CLANG_FORMAT="$HOME/.local/bin/bin-upx/clang-format-10.0.1"
|
||||||
|
fi
|
||||||
|
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||||
|
UPX_CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-10.0.1"
|
||||||
|
fi
|
||||||
|
if [[ ! -f $UPX_CLANG_FORMAT ]]; then
|
||||||
|
echo "ERROR: $0: cannot find clang-format-10.0.1"
|
||||||
|
echo "ERROR: $0: please visit https://github.com/upx/upx-stubtools"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# limit memory usage to 1 GiB (in case of clang-format problems with invalid files)
|
||||||
|
ulimit -v 1048576 || true
|
||||||
|
|
||||||
|
#echo $UPX_CLANG_FORMAT
|
||||||
|
exec "$UPX_CLANG_FORMAT" -style=file "$@"
|
||||||
|
exit 1
|
||||||
-3220
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
|||||||
*.0??
|
|
||||||
*.d
|
|
||||||
*.dat
|
|
||||||
*.idb
|
|
||||||
*.img
|
|
||||||
*.map
|
|
||||||
*.raw
|
|
||||||
*.rc
|
|
||||||
*.rel
|
|
||||||
*.res
|
|
||||||
*.pdb
|
|
||||||
*.out
|
|
||||||
*.upx
|
|
||||||
.gdbinit
|
|
||||||
GNUmakefile
|
|
||||||
MMakefile
|
|
||||||
compress_nrv.*
|
|
||||||
upx
|
|
||||||
version1*.h
|
|
||||||
version2*.h
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
*.0??
|
|
||||||
*.d
|
|
||||||
*.dat
|
|
||||||
*.idb
|
|
||||||
*.img
|
|
||||||
*.map
|
|
||||||
*.raw
|
|
||||||
*.rc
|
|
||||||
*.rel
|
|
||||||
*.res
|
|
||||||
*.pdb
|
|
||||||
*.out
|
|
||||||
*.upx
|
|
||||||
.gdbinit
|
|
||||||
GNUmakefile
|
|
||||||
MMakefile
|
|
||||||
compress_nrv.*
|
|
||||||
upx
|
|
||||||
version1*.h
|
|
||||||
version2*.h
|
|
||||||
+86
-38
@@ -1,55 +1,103 @@
|
|||||||
#
|
#
|
||||||
# UPX Makefile - needs GNU make 3.80 or better
|
# UPX Makefile - needs GNU make
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
# IMPORTANT NOTE: this Makefile is deprecated - please
|
||||||
|
# directly use the CMake build instead!
|
||||||
|
|
||||||
|
MAKEFLAGS += -r
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
export SHELL = /bin/sh
|
export SHELL = /bin/sh
|
||||||
override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1)
|
|
||||||
|
|
||||||
srcdir ?= $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
|
ifndef srcdir
|
||||||
ifneq ($(srcdir),./)
|
srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,')
|
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,' || echo 'ERROR')
|
||||||
##$(info Info: using VPATH . $(srcdir))
|
endif
|
||||||
VPATH := . $(srcdir)
|
ifndef top_srcdir
|
||||||
|
top_srcdir := $(srcdir)/..
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CXX),)
|
#
|
||||||
CXX = g++
|
# redirect to top-level CMake build
|
||||||
|
#
|
||||||
|
|
||||||
|
default: debug
|
||||||
|
all: debug release
|
||||||
|
debug: $(top_srcdir)/build/debug/upx
|
||||||
|
release: $(top_srcdir)/build/release/upx
|
||||||
|
|
||||||
|
$(top_srcdir)/build/debug/upx:
|
||||||
|
$(MAKE) -C $(top_srcdir) build/debug
|
||||||
|
$(top_srcdir)/build/release/upx:
|
||||||
|
$(MAKE) -C $(top_srcdir) build/release
|
||||||
|
|
||||||
|
.PHONY: default all debug release
|
||||||
|
.PHONY: $(top_srcdir)/build/debug/upx
|
||||||
|
.PHONY: $(top_srcdir)/build/release/upx
|
||||||
|
|
||||||
|
#
|
||||||
|
# "make run-testsuite"
|
||||||
|
#
|
||||||
|
|
||||||
|
# search for the UPX testsuite -- git clone https://github.com/upx/upx-testsuite.git
|
||||||
|
# you also can override upx_testsuite_SRCDIR
|
||||||
|
ifndef upx_testsuite_SRCDIR
|
||||||
|
# search standard locations below $(top_srcdir)
|
||||||
|
ifneq ($(wildcard $(top_srcdir)/../upx--upx-testsuite.git/files/packed/.),)
|
||||||
|
upx_testsuite_SRCDIR := $(top_srcdir)/../upx--upx-testsuite.git
|
||||||
|
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite.git/files/packed/.),)
|
||||||
|
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite.git
|
||||||
|
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite/files/packed/.),)
|
||||||
|
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite
|
||||||
endif
|
endif
|
||||||
ifeq ($(CXX),g++)
|
|
||||||
CXXFLAGS += -O2 -MMD
|
|
||||||
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Werror
|
|
||||||
endif
|
endif
|
||||||
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
|
||||||
CXXLD ?= $(CXX)
|
|
||||||
|
|
||||||
exeext ?= .out
|
# run the UPX testsuite
|
||||||
libext ?= .a
|
# The expected (old) checksums are in $(top_srcdir)/.github/travis_testsuite_1-expected_sha256sums.sh
|
||||||
objext ?= .o
|
# The actual (new) checksums are in tmp-testsuite/testsuite_1/.sha256sums.recreate
|
||||||
|
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
|
||||||
# we need UCL and zlib - you can set envvar UCLDIR
|
ifneq ($(wildcard $(top_srcdir)/.github/travis_testsuite_1.sh),)
|
||||||
ifneq ($(wildcard $(UCLDIR)/include/ucl/ucl.h),)
|
run-testsuite: export upx_exe := $(top_srcdir)/build/release/upx
|
||||||
INCLUDES += -I$(UCLDIR)/include
|
run-testsuite: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
|
||||||
LIBS += $(addprefix -L,$(dir $(wildcard $(UCLDIR)/libucl$(libext) $(UCLDIR)/src/.libs/libucl$(libext))))
|
run-testsuite: export upx_testsuite_BUILDDIR := ./tmp-testsuite
|
||||||
|
run-testsuite: $(top_srcdir)/build/release/upx
|
||||||
|
time -p bash $(top_srcdir)/.github/travis_testsuite_1.sh
|
||||||
|
.PHONY: run-testsuite
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
LIBS += -lucl -lz
|
|
||||||
|
|
||||||
upx_SOURCES := $(wildcard $(srcdir)/*.cpp)
|
#
|
||||||
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
|
# "make clang-format"
|
||||||
|
#
|
||||||
|
|
||||||
all: upx$(exeext)
|
# automatically format some C++ source code files
|
||||||
|
ifeq ($(shell uname),Linux)
|
||||||
|
CLANG_FORMAT_FILES += bele.h bele_policy.h
|
||||||
|
CLANG_FORMAT_FILES += except.cpp except.h
|
||||||
|
CLANG_FORMAT_FILES += file.cpp file.h
|
||||||
|
CLANG_FORMAT_FILES += linker.cpp linker.h packhead.cpp packmast.cpp packmast.h
|
||||||
|
CLANG_FORMAT_FILES += main.cpp options.cpp options.h packer.cpp packer.h
|
||||||
|
CLANG_FORMAT_FILES += p_tos.cpp p_tos.h
|
||||||
|
CLANG_FORMAT_FILES += s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h
|
||||||
|
CLANG_FORMAT_FILES += ui.cpp ui.h work.cpp
|
||||||
|
CLANG_FORMAT_FILES += $(wildcard util/[a-ln-z]*.[ch]* util/mem*.[ch]*)
|
||||||
|
clang-format:
|
||||||
|
$(top_srcdir)/misc/scripts/upx-clang-format -i $(addprefix $(top_srcdir)/src/,$(sort $(CLANG_FORMAT_FILES)))
|
||||||
|
.PHONY: clang-format
|
||||||
|
endif
|
||||||
|
|
||||||
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
|
#
|
||||||
$($(notdir $@).PRE_LINK_STEP)
|
# "make check-whitespace"
|
||||||
$(strip $(CXXLD) $(call e,CPPFLAGS) $(call e,CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS))
|
#
|
||||||
$($(notdir $@).POST_LINK_STEP)
|
|
||||||
|
|
||||||
%.o : %.cpp
|
CHECK_WHITESPACE =
|
||||||
$(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<)
|
ifeq ($(shell uname),Linux)
|
||||||
|
CHECK_WHITESPACE = $(top_srcdir)/misc/scripts/check_whitespace.sh $(top_srcdir)
|
||||||
|
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||||
|
CHECK_WHITESPACE = $(top_srcdir)/misc/scripts/check_whitespace_git.sh $(top_srcdir)
|
||||||
|
endif
|
||||||
|
check-whitespace : ; $(CHECK_WHITESPACE)
|
||||||
|
endif
|
||||||
|
.PHONY: check-whitespace
|
||||||
|
|
||||||
mostlyclean clean distclean maintainer-clean:
|
# vim:set ts=8 sw=8 noet:
|
||||||
rm -f *.d *.map *.o *.obj *.res upx.exe upx.out upx.ttp upx$(exeext)
|
|
||||||
|
|
||||||
-include *.d
|
|
||||||
.PHONY: all mostlyclean clean distclean maintainer-clean
|
|
||||||
|
|||||||
+558
-329
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,250 @@
|
|||||||
|
/* bele_policy.h -- access memory in BigEndian and LittleEndian byte order
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UPX_BELE_H__
|
||||||
|
#error "this is an internal include file"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if defined(BELE_CTP)
|
||||||
|
// CTP - Compile-Time Polymorphism (templates)
|
||||||
|
#define V static inline
|
||||||
|
#define S static int __acc_cdecl_qsort
|
||||||
|
#define C /*empty*/
|
||||||
|
#elif defined(BELE_RTP)
|
||||||
|
// RTP - Run-Time Polymorphism (virtual functions)
|
||||||
|
#define V virtual
|
||||||
|
#define S virtual int
|
||||||
|
#define C const
|
||||||
|
#else
|
||||||
|
#error
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BELE_RTP)
|
||||||
|
struct AbstractPolicy {
|
||||||
|
inline AbstractPolicy() {}
|
||||||
|
virtual inline ~AbstractPolicy() {}
|
||||||
|
V bool isBE() C = 0;
|
||||||
|
V bool isLE() C = 0;
|
||||||
|
|
||||||
|
V unsigned get16(const void *p) C = 0;
|
||||||
|
V unsigned get24(const void *p) C = 0;
|
||||||
|
V unsigned get32(const void *p) C = 0;
|
||||||
|
V upx_uint64_t get64(const void *p) C = 0;
|
||||||
|
|
||||||
|
V void set16(void *p, unsigned v) C = 0;
|
||||||
|
V void set24(void *p, unsigned v) C = 0;
|
||||||
|
V void set32(void *p, unsigned v) C = 0;
|
||||||
|
V void set64(void *p, upx_uint64_t v) C = 0;
|
||||||
|
|
||||||
|
V int get16_signed(const void *p) C = 0;
|
||||||
|
V int get24_signed(const void *p) C = 0;
|
||||||
|
V int get32_signed(const void *p) C = 0;
|
||||||
|
V upx_int64_t get64_signed(const void *p) C = 0;
|
||||||
|
|
||||||
|
S u16_compare(const void *a, const void *b) C = 0;
|
||||||
|
S u24_compare(const void *a, const void *b) C = 0;
|
||||||
|
S u32_compare(const void *a, const void *b) C = 0;
|
||||||
|
S u64_compare(const void *a, const void *b) C = 0;
|
||||||
|
|
||||||
|
S u16_compare_signed(const void *a, const void *b) C = 0;
|
||||||
|
S u24_compare_signed(const void *a, const void *b) C = 0;
|
||||||
|
S u32_compare_signed(const void *a, const void *b) C = 0;
|
||||||
|
S u64_compare_signed(const void *a, const void *b) C = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// disable copy, assignment and move assignment
|
||||||
|
AbstractPolicy(const AbstractPolicy &) = delete;
|
||||||
|
AbstractPolicy &operator=(const AbstractPolicy &) = delete;
|
||||||
|
AbstractPolicy &operator=(AbstractPolicy &&) = delete;
|
||||||
|
// disable dynamic allocation
|
||||||
|
ACC_CXX_DISABLE_NEW_DELETE
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BELE_RTP)
|
||||||
|
#undef C
|
||||||
|
#define C const override
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct BEPolicy
|
||||||
|
#if defined(BELE_RTP)
|
||||||
|
final : public AbstractPolicy
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
inline BEPolicy() {}
|
||||||
|
#if defined(BELE_CTP)
|
||||||
|
typedef N_BELE_RTP::BEPolicy RTP_Policy;
|
||||||
|
#elif defined(BELE_RTP)
|
||||||
|
typedef N_BELE_CTP::BEPolicy CTP_Policy;
|
||||||
|
#endif
|
||||||
|
V bool isBE() C { return true; }
|
||||||
|
V bool isLE() C { return false; }
|
||||||
|
|
||||||
|
typedef BE16 U16;
|
||||||
|
typedef BE32 U32;
|
||||||
|
typedef BE64 U64;
|
||||||
|
|
||||||
|
V unsigned get16(const void *p) C { return get_be16(p); }
|
||||||
|
V unsigned get24(const void *p) C { return get_be24(p); }
|
||||||
|
V unsigned get32(const void *p) C { return get_be32(p); }
|
||||||
|
V upx_uint64_t get64(const void *p) C { return get_be64(p); }
|
||||||
|
|
||||||
|
V void set16(void *p, unsigned v) C { set_be16(p, v); }
|
||||||
|
V void set24(void *p, unsigned v) C { set_be24(p, v); }
|
||||||
|
V void set32(void *p, unsigned v) C { set_be32(p, v); }
|
||||||
|
V void set64(void *p, upx_uint64_t v) C { set_be64(p, v); }
|
||||||
|
|
||||||
|
V int get16_signed(const void *p) C { return get_be16_signed(p); }
|
||||||
|
V int get24_signed(const void *p) C { return get_be24_signed(p); }
|
||||||
|
V int get32_signed(const void *p) C { return get_be32_signed(p); }
|
||||||
|
V upx_int64_t get64_signed(const void *p) C { return get_be64_signed(p); }
|
||||||
|
|
||||||
|
S u16_compare(const void *a, const void *b) C { return be16_compare(a, b); }
|
||||||
|
S u24_compare(const void *a, const void *b) C { return be24_compare(a, b); }
|
||||||
|
S u32_compare(const void *a, const void *b) C { return be32_compare(a, b); }
|
||||||
|
S u64_compare(const void *a, const void *b) C { return be64_compare(a, b); }
|
||||||
|
|
||||||
|
S u16_compare_signed(const void *a, const void *b) C { return be16_compare_signed(a, b); }
|
||||||
|
S u24_compare_signed(const void *a, const void *b) C { return be24_compare_signed(a, b); }
|
||||||
|
S u32_compare_signed(const void *a, const void *b) C { return be32_compare_signed(a, b); }
|
||||||
|
S u64_compare_signed(const void *a, const void *b) C { return be64_compare_signed(a, b); }
|
||||||
|
|
||||||
|
static void compileTimeAssertions() {
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U16)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U32)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U64)
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// disable copy, assignment and move assignment
|
||||||
|
BEPolicy(const BEPolicy &) = delete;
|
||||||
|
BEPolicy &operator=(const BEPolicy &) = delete;
|
||||||
|
BEPolicy &operator=(BEPolicy &&) = delete;
|
||||||
|
// disable dynamic allocation
|
||||||
|
ACC_CXX_DISABLE_NEW_DELETE
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LEPolicy
|
||||||
|
#if defined(BELE_RTP)
|
||||||
|
final : public AbstractPolicy
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
inline LEPolicy() {}
|
||||||
|
#if defined(BELE_CTP)
|
||||||
|
typedef N_BELE_RTP::LEPolicy RTP_Policy;
|
||||||
|
#elif defined(BELE_RTP)
|
||||||
|
typedef N_BELE_CTP::LEPolicy CTP_Policy;
|
||||||
|
#endif
|
||||||
|
V bool isBE() C { return false; }
|
||||||
|
V bool isLE() C { return true; }
|
||||||
|
|
||||||
|
typedef LE16 U16;
|
||||||
|
typedef LE32 U32;
|
||||||
|
typedef LE64 U64;
|
||||||
|
|
||||||
|
V unsigned get16(const void *p) C { return get_le16(p); }
|
||||||
|
V unsigned get24(const void *p) C { return get_le24(p); }
|
||||||
|
V unsigned get32(const void *p) C { return get_le32(p); }
|
||||||
|
V upx_uint64_t get64(const void *p) C { return get_le64(p); }
|
||||||
|
|
||||||
|
V void set16(void *p, unsigned v) C { set_le16(p, v); }
|
||||||
|
V void set24(void *p, unsigned v) C { set_le24(p, v); }
|
||||||
|
V void set32(void *p, unsigned v) C { set_le32(p, v); }
|
||||||
|
V void set64(void *p, upx_uint64_t v) C { set_le64(p, v); }
|
||||||
|
|
||||||
|
V int get16_signed(const void *p) C { return get_le16_signed(p); }
|
||||||
|
V int get24_signed(const void *p) C { return get_le24_signed(p); }
|
||||||
|
V int get32_signed(const void *p) C { return get_le32_signed(p); }
|
||||||
|
V upx_int64_t get64_signed(const void *p) C { return get_le64_signed(p); }
|
||||||
|
|
||||||
|
S u16_compare(const void *a, const void *b) C { return le16_compare(a, b); }
|
||||||
|
S u24_compare(const void *a, const void *b) C { return le24_compare(a, b); }
|
||||||
|
S u32_compare(const void *a, const void *b) C { return le32_compare(a, b); }
|
||||||
|
S u64_compare(const void *a, const void *b) C { return le64_compare(a, b); }
|
||||||
|
|
||||||
|
S u16_compare_signed(const void *a, const void *b) C { return le16_compare_signed(a, b); }
|
||||||
|
S u24_compare_signed(const void *a, const void *b) C { return le24_compare_signed(a, b); }
|
||||||
|
S u32_compare_signed(const void *a, const void *b) C { return le32_compare_signed(a, b); }
|
||||||
|
S u64_compare_signed(const void *a, const void *b) C { return le64_compare_signed(a, b); }
|
||||||
|
|
||||||
|
static void compileTimeAssertions() {
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U16)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U32)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(U64)
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// disable copy, assignment and move assignment
|
||||||
|
LEPolicy(const LEPolicy &) = delete;
|
||||||
|
LEPolicy &operator=(const LEPolicy &) = delete;
|
||||||
|
LEPolicy &operator=(LEPolicy &&) = delete;
|
||||||
|
// disable dynamic allocation
|
||||||
|
ACC_CXX_DISABLE_NEW_DELETE
|
||||||
|
};
|
||||||
|
|
||||||
|
// native policy (aka host policy)
|
||||||
|
#if (ACC_ABI_BIG_ENDIAN)
|
||||||
|
typedef BEPolicy HostPolicy;
|
||||||
|
#elif (ACC_ABI_LITTLE_ENDIAN)
|
||||||
|
typedef LEPolicy HostPolicy;
|
||||||
|
#else
|
||||||
|
#error "ACC_ABI_ENDIAN"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
struct HostAlignedPolicy {
|
||||||
|
#if defined(BELE_CTP)
|
||||||
|
enum { isBE = HostPolicy::isBE, isLE = HostPolicy::isLE };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef upx_uint16_t U16;
|
||||||
|
typedef upx_uint32_t U32;
|
||||||
|
typedef upx_uint64_t U64;
|
||||||
|
|
||||||
|
static void compileTimeAssertions() {
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U32) == 4)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(U64) == 8)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef V
|
||||||
|
#undef S
|
||||||
|
#undef C
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
-115
@@ -1,115 +0,0 @@
|
|||||||
/* bptr.h --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_BPTR_H
|
|
||||||
#define __UPX_BPTR_H
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
// BoundedPtr
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
class BoundedPtr
|
|
||||||
{
|
|
||||||
// typedef BoundedPtr<T> Self;
|
|
||||||
public:
|
|
||||||
typedef T* StoredType;
|
|
||||||
typedef T* PointerType;
|
|
||||||
typedef T& ReferenceType;
|
|
||||||
|
|
||||||
~BoundedPtr() { }
|
|
||||||
|
|
||||||
explicit BoundedPtr(void* base, unsigned size, T* ptr=0)
|
|
||||||
: ptr_(ptr), base_(base), size_(size) { check(); }
|
|
||||||
BoundedPtr& operator= (const BoundedPtr& other) {
|
|
||||||
assert(base_ == other.base_); assert(size_ == other.size_);
|
|
||||||
ptr_ = other.ptr_; check(); return *this;
|
|
||||||
}
|
|
||||||
BoundedPtr& operator= (T* other) {
|
|
||||||
ptr_ = other; check(); return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
operator T* () { check(); return ptr_; }
|
|
||||||
operator const T* () const { check(); return ptr_; }
|
|
||||||
|
|
||||||
BoundedPtr& operator += (size_t n) {
|
|
||||||
checkStrict(); ptr_ += n; checkStrict(); return *this;
|
|
||||||
}
|
|
||||||
BoundedPtr& operator -= (size_t n) {
|
|
||||||
checkStrict(); ptr_ -= n; checkStrict(); return *this;
|
|
||||||
}
|
|
||||||
BoundedPtr& operator ++ (void) {
|
|
||||||
checkStrict(); ptr_ += 1; checkStrict(); return *this;
|
|
||||||
}
|
|
||||||
// T* operator ++ (int) {
|
|
||||||
// T* p = ptr_; checkStrict(); ptr_ += 1; checkStrict(); return p;
|
|
||||||
// }
|
|
||||||
// BoundedPtr& operator -- (void) {
|
|
||||||
// checkStrict(); ptr_ -= 1; checkStrict(); return *this;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
void checkNULL() const {
|
|
||||||
if (!ptr_)
|
|
||||||
throwCantUnpack("unexpected NULL pointer; take care!");
|
|
||||||
}
|
|
||||||
void checkRange(size_t extra=0) const {
|
|
||||||
size_t off = (const char *) ptr_ - (const char *) base_;
|
|
||||||
if (off > size_ || off + extra > size_)
|
|
||||||
throwCantUnpack("pointer out of range; take care!");
|
|
||||||
}
|
|
||||||
void checkStrict(size_t extra=0) const {
|
|
||||||
checkNULL();
|
|
||||||
checkRange(extra);
|
|
||||||
}
|
|
||||||
void check(size_t extra=0) const {
|
|
||||||
if (ptr_) checkRange(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
T* ptr_;
|
|
||||||
void* base_;
|
|
||||||
size_t size_;
|
|
||||||
|
|
||||||
// disable copy
|
|
||||||
BoundedPtr(const BoundedPtr&); // {}
|
|
||||||
// BoundedPtr& operator= (const BoundedPtr&); // { return *this; }
|
|
||||||
|
|
||||||
// disable dynamic allocation
|
|
||||||
DISABLE_NEW_DELETE
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* already included */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
+6
-10
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,13 +22,13 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
@@ -72,7 +72,7 @@ static void print0(FILE *f, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -89,8 +89,4 @@ console_t console_file =
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+14
-18
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,15 +22,15 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
FILE *con_term = NULL;
|
FILE *con_term = nullptr;
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
@@ -60,7 +60,7 @@ static void try_init(console_t *c, FILE *f)
|
|||||||
{
|
{
|
||||||
con_mode = k;
|
con_mode = k;
|
||||||
con = c;
|
con = c;
|
||||||
con->init = 0;
|
con->init = nullptr;
|
||||||
if (!con->set_fg)
|
if (!con->set_fg)
|
||||||
con->set_fg = console_none.set_fg;
|
con->set_fg = console_none.set_fg;
|
||||||
if (!con->print0)
|
if (!con->print0)
|
||||||
@@ -84,14 +84,14 @@ static int do_init(FILE *f)
|
|||||||
if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO))
|
if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO))
|
||||||
return con_mode;
|
return con_mode;
|
||||||
|
|
||||||
#if defined(USE_ANSI)
|
#if (USE_ANSI)
|
||||||
try_init(&console_ansi_mono,f);
|
try_init(&console_ansi_mono,f);
|
||||||
try_init(&console_ansi_color,f);
|
try_init(&console_ansi_color,f);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
try_init(&console_screen,f);
|
try_init(&console_screen,f);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_AALIB)
|
#if (USE_AALIB)
|
||||||
try_init(&console_aalib,f);
|
try_init(&console_aalib,f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ static int set_fg(FILE *f, int fg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
if (con == me)
|
if (con == me)
|
||||||
init(f,-1,-1);
|
init(f,-1,-1);
|
||||||
@@ -137,18 +137,18 @@ console_t console_init =
|
|||||||
{
|
{
|
||||||
init,
|
init,
|
||||||
set_fg,
|
set_fg,
|
||||||
0,
|
nullptr,
|
||||||
intro
|
intro
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...)
|
void con_fprintf(FILE *f, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[80*25];
|
char buf[80*25];
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
upx_vsnprintf(buf, sizeof(buf), format,args);
|
upx_safe_vsnprintf(buf, sizeof(buf), format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (con == me)
|
if (con == me)
|
||||||
@@ -159,8 +159,4 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...)
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+6
-10
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,13 +22,13 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
@@ -58,7 +58,7 @@ static void print0(FILE *f, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -75,8 +75,4 @@ console_t console_none =
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+16
-20
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,13 +22,13 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
@@ -72,11 +72,11 @@ static int do_init(screen_t *s, int fd)
|
|||||||
static screen_t *do_construct(screen_t *s, int fd)
|
static screen_t *do_construct(screen_t *s, int fd)
|
||||||
{
|
{
|
||||||
if (!s)
|
if (!s)
|
||||||
return NULL;
|
return nullptr;
|
||||||
if (do_init(s,fd) != 0)
|
if (do_init(s,fd) != 0)
|
||||||
{
|
{
|
||||||
s->destroy(s);
|
s->destroy(s);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ static screen_t *do_construct(screen_t *s, int fd)
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static screen_t *screen = NULL;
|
static screen_t *screen = nullptr;
|
||||||
|
|
||||||
static void __acc_cdecl_atexit do_destroy(void)
|
static void __acc_cdecl_atexit do_destroy(void)
|
||||||
{
|
{
|
||||||
@@ -95,7 +95,7 @@ static void __acc_cdecl_atexit do_destroy(void)
|
|||||||
if (screen->atExit)
|
if (screen->atExit)
|
||||||
screen->atExit();
|
screen->atExit();
|
||||||
screen->destroy(screen);
|
screen->destroy(screen);
|
||||||
screen = NULL;
|
screen = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ static int init(FILE *f, int o, int now)
|
|||||||
int n;
|
int n;
|
||||||
|
|
||||||
UNUSED(now);
|
UNUSED(now);
|
||||||
assert(screen == NULL);
|
assert(screen == nullptr);
|
||||||
|
|
||||||
if (o == CON_SCREEN)
|
if (o == CON_SCREEN)
|
||||||
n = CON_SCREEN;
|
n = CON_SCREEN;
|
||||||
@@ -126,19 +126,19 @@ static int init(FILE *f, int o, int now)
|
|||||||
else
|
else
|
||||||
return CON_INIT;
|
return CON_INIT;
|
||||||
|
|
||||||
#if defined(__DJGPP__)
|
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_djgpp2_construct(),fd);
|
screen = do_construct(screen_djgpp2_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_WIN32)
|
#if (USE_SCREEN_WIN32)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_win32_construct(),fd);
|
screen = do_construct(screen_win32_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_VCSA)
|
#if (USE_SCREEN_VCSA)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_vcsa_construct(),fd);
|
screen = do_construct(screen_vcsa_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_CURSES)
|
#if (USE_SCREEN_CURSES)
|
||||||
if (!screen && o == CON_SCREEN)
|
if (!screen && o == CON_SCREEN)
|
||||||
screen = do_construct(screen_curses_construct(),fd);
|
screen = do_construct(screen_curses_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
@@ -295,10 +295,10 @@ static void print0(FILE *f, const char *ss)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static upx_bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
#if defined(USE_FRAMES)
|
#if (USE_FRAMES)
|
||||||
if (screen->intro)
|
if (screen->intro)
|
||||||
return screen->intro(screen,screen_show_frames);
|
return screen->intro(screen,screen_show_frames);
|
||||||
#endif
|
#endif
|
||||||
@@ -317,8 +317,4 @@ console_t console_screen =
|
|||||||
|
|
||||||
#endif /* USE_SCREEN */
|
#endif /* USE_SCREEN */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
-278
@@ -1,278 +0,0 @@
|
|||||||
/* compress.ch --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if 1 && defined(UCL_USE_ASM)
|
|
||||||
# include <ucl/ucl_asm.h>
|
|
||||||
# define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8
|
|
||||||
# define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16
|
|
||||||
# define ucl_nrv2b_decompress_safe_le32 ucl_nrv2b_decompress_asm_safe_le32
|
|
||||||
# define ucl_nrv2d_decompress_safe_8 ucl_nrv2d_decompress_asm_safe_8
|
|
||||||
# define ucl_nrv2d_decompress_safe_le16 ucl_nrv2d_decompress_asm_safe_le16
|
|
||||||
# define ucl_nrv2d_decompress_safe_le32 ucl_nrv2d_decompress_asm_safe_le32
|
|
||||||
# define ucl_nrv2e_decompress_safe_8 ucl_nrv2e_decompress_asm_safe_8
|
|
||||||
# define ucl_nrv2e_decompress_safe_le16 ucl_nrv2e_decompress_asm_safe_le16
|
|
||||||
# define ucl_nrv2e_decompress_safe_le32 ucl_nrv2e_decompress_asm_safe_le32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if defined(upx_adler32)
|
|
||||||
unsigned upx_adler32(const void *buf, unsigned len, unsigned adler)
|
|
||||||
{
|
|
||||||
if (len == 0)
|
|
||||||
return adler;
|
|
||||||
assert(buf != NULL);
|
|
||||||
return ucl_adler32(adler, (const ucl_bytep)buf, len);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(upx_crc32)
|
|
||||||
unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
|
|
||||||
{
|
|
||||||
if (len == 0)
|
|
||||||
return crc;
|
|
||||||
assert(buf != NULL);
|
|
||||||
return ucl_crc32(crc, (const ucl_bytep)buf, len);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if defined(upx_compress)
|
|
||||||
|
|
||||||
int upx_compress ( const upx_bytep src, upx_uint src_len,
|
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
|
||||||
upx_progress_callback_t *cb,
|
|
||||||
int method, int level,
|
|
||||||
const struct upx_compress_config_t *conf_parm,
|
|
||||||
upx_uintp result )
|
|
||||||
{
|
|
||||||
struct upx_compress_config_t conf;
|
|
||||||
upx_uint result_buffer[16];
|
|
||||||
int r = UPX_E_ERROR;
|
|
||||||
|
|
||||||
assert(level > 0);
|
|
||||||
memset(&conf, 0xff, sizeof(conf));
|
|
||||||
if (conf_parm)
|
|
||||||
conf = *conf_parm; // struct copy
|
|
||||||
if (!result)
|
|
||||||
result = result_buffer;
|
|
||||||
|
|
||||||
// assume no info available - fill in worst case results
|
|
||||||
//result[0] = 1; // min_offset_found - NOT USED
|
|
||||||
result[1] = src_len - 1; // max_offset_found
|
|
||||||
//result[2] = 2; // min_match_found - NOT USED
|
|
||||||
result[3] = src_len - 1; // max_match_found
|
|
||||||
//result[4] = 1; // min_run_found - NOT USED
|
|
||||||
result[5] = src_len; // max_run_found
|
|
||||||
result[6] = 1; // first_offset_found
|
|
||||||
//result[7] = 999999; // same_match_offsets_found - NOT USED
|
|
||||||
|
|
||||||
// prepare bit-buffer settings
|
|
||||||
conf.bb_endian = 0;
|
|
||||||
conf.bb_size = 0;
|
|
||||||
if (method >= M_NRV2B_LE32 && method <= M_CL1B_LE16)
|
|
||||||
{
|
|
||||||
static const unsigned char sizes[3]={32,8,16};
|
|
||||||
conf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
throwInternalError("unknown compression method");
|
|
||||||
|
|
||||||
// optimize compression parms
|
|
||||||
if (level <= 3 && conf.max_offset == UPX_UINT_MAX)
|
|
||||||
conf.max_offset = 8*1024-1;
|
|
||||||
else if (level == 4 && conf.max_offset == UPX_UINT_MAX)
|
|
||||||
conf.max_offset = 32*1024-1;
|
|
||||||
|
|
||||||
if M_IS_NRV2B(method)
|
|
||||||
r = ucl_nrv2b_99_compress(src, src_len, dst, dst_len,
|
|
||||||
cb, level, &conf, result);
|
|
||||||
else if M_IS_NRV2D(method)
|
|
||||||
r = ucl_nrv2d_99_compress(src, src_len, dst, dst_len,
|
|
||||||
cb, level, &conf, result);
|
|
||||||
#if defined(ALG_NRV2E)
|
|
||||||
else if M_IS_NRV2E(method)
|
|
||||||
r = ucl_nrv2e_99_compress(src, src_len, dst, dst_len,
|
|
||||||
cb, level, &conf, result);
|
|
||||||
#endif
|
|
||||||
#if 0 /*{*/
|
|
||||||
else if M_IS_CL1B(method)
|
|
||||||
r = cl1b_compress(src, src_len, dst, dst_len,
|
|
||||||
cb, level, &conf, result);
|
|
||||||
#endif /*}*/
|
|
||||||
else
|
|
||||||
throwInternalError("unknown compression method");
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* upx_compress */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if defined(upx_decompress)
|
|
||||||
|
|
||||||
int upx_decompress ( const upx_bytep src, upx_uint src_len,
|
|
||||||
upx_bytep dst, upx_uintp dst_len,
|
|
||||||
int method )
|
|
||||||
{
|
|
||||||
int r = UPX_E_ERROR;
|
|
||||||
|
|
||||||
switch (method)
|
|
||||||
{
|
|
||||||
case M_NRV2B_8:
|
|
||||||
r = ucl_nrv2b_decompress_safe_8(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2B_LE16:
|
|
||||||
r = ucl_nrv2b_decompress_safe_le16(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2B_LE32:
|
|
||||||
r = ucl_nrv2b_decompress_safe_le32(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_8:
|
|
||||||
r = ucl_nrv2d_decompress_safe_8(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_LE16:
|
|
||||||
r = ucl_nrv2d_decompress_safe_le16(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_LE32:
|
|
||||||
r = ucl_nrv2d_decompress_safe_le32(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#if defined(ALG_NRV2E)
|
|
||||||
case M_NRV2E_8:
|
|
||||||
r = ucl_nrv2e_decompress_safe_8(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2E_LE16:
|
|
||||||
r = ucl_nrv2e_decompress_safe_le16(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2E_LE32:
|
|
||||||
r = ucl_nrv2e_decompress_safe_le32(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#if 0 /*{*/
|
|
||||||
case M_CL1B_8:
|
|
||||||
r = cl1b_decompress_safe_8(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_CL1B_LE16:
|
|
||||||
r = cl1b_decompress_safe_le16(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_CL1B_LE32:
|
|
||||||
r = cl1b_decompress_safe_le32(src,src_len,dst,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#endif /*}*/
|
|
||||||
default:
|
|
||||||
throwInternalError("unknown decompression method");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* upx_decompress */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if defined(upx_test_overlap)
|
|
||||||
|
|
||||||
int upx_test_overlap ( const upx_bytep buf, upx_uint src_off,
|
|
||||||
upx_uint src_len, upx_uintp dst_len,
|
|
||||||
int method )
|
|
||||||
{
|
|
||||||
int r = UPX_E_ERROR;
|
|
||||||
|
|
||||||
switch (method)
|
|
||||||
{
|
|
||||||
case M_NRV2B_8:
|
|
||||||
r = ucl_nrv2b_test_overlap_8(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2B_LE16:
|
|
||||||
r = ucl_nrv2b_test_overlap_le16(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2B_LE32:
|
|
||||||
r = ucl_nrv2b_test_overlap_le32(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_8:
|
|
||||||
r = ucl_nrv2d_test_overlap_8(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_LE16:
|
|
||||||
r = ucl_nrv2d_test_overlap_le16(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2D_LE32:
|
|
||||||
r = ucl_nrv2d_test_overlap_le32(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#if defined(ALG_NRV2E)
|
|
||||||
case M_NRV2E_8:
|
|
||||||
r = ucl_nrv2e_test_overlap_8(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2E_LE16:
|
|
||||||
r = ucl_nrv2e_test_overlap_le16(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_NRV2E_LE32:
|
|
||||||
r = ucl_nrv2e_test_overlap_le32(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#if 0 /*{*/
|
|
||||||
case M_CL1B_8:
|
|
||||||
r = cl1b_test_overlap_8(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_CL1B_LE16:
|
|
||||||
r = cl1b_test_overlap_le16(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
case M_CL1B_LE32:
|
|
||||||
r = cl1b_test_overlap_le32(buf,src_off,src_len,dst_len,NULL);
|
|
||||||
break;
|
|
||||||
#endif /*}*/
|
|
||||||
default:
|
|
||||||
throwInternalError("unknown decompression method");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* upx_test_overlap */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
+185
-17
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,29 +22,197 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
|
#include "util/membuffer.h"
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_NRV)
|
/*************************************************************************
|
||||||
# include "compress_nrv.ch"
|
//
|
||||||
#elif defined(WITH_UCL)
|
**************************************************************************/
|
||||||
# define ALG_NRV2E
|
|
||||||
# define upx_adler32 upx_adler32
|
unsigned upx_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
//# define upx_crc32 upx_crc32
|
{
|
||||||
# define upx_compress upx_compress
|
if (len == 0)
|
||||||
# define upx_decompress upx_decompress
|
return adler;
|
||||||
# define upx_test_overlap upx_test_overlap
|
assert(buf != nullptr);
|
||||||
# include "compress.ch"
|
#if 1
|
||||||
|
return upx_ucl_adler32(buf, len, adler);
|
||||||
#else
|
#else
|
||||||
# error
|
return upx_zlib_adler32(buf, len, adler);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
|
{
|
||||||
|
if (len == 0)
|
||||||
|
return crc;
|
||||||
|
assert(buf != nullptr);
|
||||||
|
#if 1
|
||||||
|
return upx_ucl_crc32(buf, len, crc);
|
||||||
|
#else
|
||||||
|
return upx_zlib_crc32(buf, len, crc);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* UNUSED */
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_compress( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf,
|
||||||
|
upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
upx_compress_result_t cresult_buffer;
|
||||||
|
|
||||||
|
assert(method > 0); assert(level > 0);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
// set available bytes in dst
|
||||||
|
if (*dst_len == 0)
|
||||||
|
*dst_len = MemBuffer::getSizeForCompression(src_len);
|
||||||
|
#else
|
||||||
|
// force users to provide *dst_len
|
||||||
|
assert(*dst_len != 0);
|
||||||
|
#endif
|
||||||
|
// for UPX, we always require a reasonably sized outbut buffer
|
||||||
|
assert(*dst_len >= MemBuffer::getSizeForCompression(src_len));
|
||||||
|
|
||||||
|
if (!cresult)
|
||||||
|
cresult = &cresult_buffer;
|
||||||
|
memset(cresult, 0, sizeof(*cresult));
|
||||||
|
#if 1
|
||||||
|
// debug
|
||||||
|
cresult->method = method;
|
||||||
|
cresult->level = level;
|
||||||
|
cresult->u_len = src_len;
|
||||||
|
cresult->c_len = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if __acc_cte(0) {
|
||||||
|
}
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
else if (M_IS_LZMA(method))
|
||||||
|
r = upx_lzma_compress(src, src_len, dst, dst_len,
|
||||||
|
cb, method, level, cconf, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_NRV)
|
||||||
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
|
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
||||||
|
cb, method, level, cconf, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_UCL)
|
||||||
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
|
r = upx_ucl_compress(src, src_len, dst, dst_len,
|
||||||
|
cb, method, level, cconf, cresult);
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
throwInternalError("unknown compression method");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
#if 1
|
||||||
vi:ts=4:et:nowrap
|
// debug
|
||||||
*/
|
cresult->c_len = *dst_len;
|
||||||
|
#endif
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_decompress(const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
|
||||||
|
assert(*dst_len > 0);
|
||||||
|
assert(src_len < *dst_len); // must be compressed
|
||||||
|
|
||||||
|
if (cresult && cresult->method == 0)
|
||||||
|
cresult = nullptr;
|
||||||
|
|
||||||
|
if __acc_cte(0) {
|
||||||
|
}
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
else if (M_IS_LZMA(method))
|
||||||
|
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_NRV)
|
||||||
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
|
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_UCL)
|
||||||
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
|
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_ZLIB)
|
||||||
|
else if (M_IS_DEFLATE(method))
|
||||||
|
r = upx_zlib_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
throwInternalError("unknown decompression method");
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_test_overlap( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
|
||||||
|
if (cresult && cresult->method == 0)
|
||||||
|
cresult = nullptr;
|
||||||
|
|
||||||
|
assert(*dst_len > 0);
|
||||||
|
assert(src_len < *dst_len); // must be compressed
|
||||||
|
unsigned overlap_overhead = src_off + src_len - *dst_len;
|
||||||
|
assert((int)overlap_overhead > 0);
|
||||||
|
|
||||||
|
if __acc_cte(0) {
|
||||||
|
}
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
else if (M_IS_LZMA(method))
|
||||||
|
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_NRV)
|
||||||
|
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
|
||||||
|
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
#if (WITH_UCL)
|
||||||
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
|
r = upx_ucl_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
throwInternalError("unknown decompression method");
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
/* compress.h --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __UPX_COMPRESS_H
|
||||||
|
#define __UPX_COMPRESS_H 1
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
int upx_lzma_init(void);
|
||||||
|
const char *upx_lzma_version_string(void);
|
||||||
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf,
|
||||||
|
upx_compress_result_t *cresult );
|
||||||
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
int upx_lzma_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (WITH_NRV)
|
||||||
|
int upx_nrv_init(void);
|
||||||
|
const char *upx_nrv_version_string(void);
|
||||||
|
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf,
|
||||||
|
upx_compress_result_t *cresult );
|
||||||
|
int upx_nrv_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
int upx_nrv_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (WITH_UCL)
|
||||||
|
int upx_ucl_init(void);
|
||||||
|
const char *upx_ucl_version_string(void);
|
||||||
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf,
|
||||||
|
upx_compress_result_t *cresult );
|
||||||
|
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
int upx_ucl_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler);
|
||||||
|
unsigned upx_ucl_crc32 (const void *buf, unsigned len, unsigned crc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if (WITH_ZLIB)
|
||||||
|
int upx_zlib_init(void);
|
||||||
|
const char *upx_zlib_version_string(void);
|
||||||
|
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf,
|
||||||
|
upx_compress_result_t *cresult );
|
||||||
|
int upx_zlib_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
int upx_zlib_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult );
|
||||||
|
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler);
|
||||||
|
unsigned upx_zlib_crc32 (const void *buf, unsigned len, unsigned crc);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
@@ -0,0 +1,540 @@
|
|||||||
|
/* compress_lzma.cpp --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
|
#include "util/membuffer.h"
|
||||||
|
|
||||||
|
#if (ACC_CC_CLANG)
|
||||||
|
# pragma clang diagnostic ignored "-Wshadow"
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_GNUC >= 0x040200)
|
||||||
|
# pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_MSC)
|
||||||
|
# pragma warning(disable: 4456) // -Wno-shadow
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_MSC && (_MSC_VER < 1900))
|
||||||
|
# pragma warning(disable: 4127) // warning C4127: conditional expression is constant
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_INTELC_GNUC)
|
||||||
|
# pragma warning(error: 424) // #424: extra ";" ignored
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void lzma_compress_config_t::reset()
|
||||||
|
{
|
||||||
|
pos_bits.reset();
|
||||||
|
lit_pos_bits.reset();
|
||||||
|
lit_context_bits.reset();
|
||||||
|
dict_size.reset();
|
||||||
|
fast_mode = 2;
|
||||||
|
num_fast_bytes.reset();
|
||||||
|
match_finder_cycles = 0;
|
||||||
|
|
||||||
|
max_num_probs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// INFO: the LZMA SDK is covered by a permissive license which allows
|
||||||
|
// using unmodified LZMA source code in UPX and the UPX stubs.
|
||||||
|
// See SPECIAL EXCEPTION below.
|
||||||
|
//
|
||||||
|
// Quoting from lzma-4.43/lzma.txt:
|
||||||
|
//
|
||||||
|
// LICENSE
|
||||||
|
// -------
|
||||||
|
//
|
||||||
|
// LZMA SDK is available under any of the following licenses:
|
||||||
|
//
|
||||||
|
// 1) GNU Lesser General Public License (GNU LGPL)
|
||||||
|
// 2) Common Public License (CPL)
|
||||||
|
// 3) Simplified license for unmodified code (read SPECIAL EXCEPTION)
|
||||||
|
// 4) Proprietary license
|
||||||
|
//
|
||||||
|
// It means that you can select one of these four options and follow rules
|
||||||
|
// of that license.
|
||||||
|
//
|
||||||
|
// 1,2) GNU LGPL and CPL licenses are pretty similar and both these
|
||||||
|
// licenses are classified as
|
||||||
|
// - "Free software licenses" at http://www.gnu.org/
|
||||||
|
// - "OSI-approved" at http://www.opensource.org/
|
||||||
|
//
|
||||||
|
// 3) SPECIAL EXCEPTION
|
||||||
|
//
|
||||||
|
// Igor Pavlov, as the author of this code, expressly permits you
|
||||||
|
// to statically or dynamically link your code (or bind by name)
|
||||||
|
// to the files from LZMA SDK without subjecting your linked
|
||||||
|
// code to the terms of the CPL or GNU LGPL.
|
||||||
|
// Any modifications or additions to files from LZMA SDK, however,
|
||||||
|
// are subject to the GNU LGPL or CPL terms.
|
||||||
|
//
|
||||||
|
// SPECIAL EXCEPTION allows you to use LZMA SDK in applications with closed code,
|
||||||
|
// while you keep LZMA SDK code unmodified.
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// compress defaults
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static int prepare(lzma_compress_result_t *res,
|
||||||
|
unsigned src_len, int method, int level,
|
||||||
|
const lzma_compress_config_t *lcconf)
|
||||||
|
{
|
||||||
|
// setup defaults
|
||||||
|
res->pos_bits = 2; // 0 .. 4
|
||||||
|
res->lit_pos_bits = 0; // 0 .. 4
|
||||||
|
res->lit_context_bits = 3; // 0 .. 8
|
||||||
|
res->dict_size = 4 * 1024 * 1024; // 1 .. 2**30
|
||||||
|
res->fast_mode = 2;
|
||||||
|
res->num_fast_bytes = 64; // 5 .. 273
|
||||||
|
res->match_finder_cycles = 0;
|
||||||
|
// UPX overrides
|
||||||
|
res->pos_bits = lzma_compress_config_t::pos_bits_t::default_value;
|
||||||
|
res->lit_pos_bits = lzma_compress_config_t::lit_pos_bits_t::default_value;
|
||||||
|
res->lit_context_bits = lzma_compress_config_t::lit_context_bits_t::default_value;
|
||||||
|
res->dict_size = lzma_compress_config_t::dict_size_t::default_value;
|
||||||
|
res->num_fast_bytes = lzma_compress_config_t::num_fast_bytes_t::default_value;
|
||||||
|
// method overrides
|
||||||
|
if (method >= 0x100) {
|
||||||
|
res->pos_bits = (method >> 16) & 15;
|
||||||
|
res->lit_pos_bits = (method >> 12) & 15;
|
||||||
|
res->lit_context_bits = (method >> 8) & 15;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
// DEBUG - set sizes so that we use a maxmimum amount of stack.
|
||||||
|
// These settings cause res->num_probs == 3147574, i.e. we will
|
||||||
|
// need about 6 MiB of stack during runtime decompression.
|
||||||
|
res->lit_pos_bits = 4;
|
||||||
|
res->lit_context_bits = 8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// TODO: tune these settings according to level
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
res->dict_size = 256 * 1024;
|
||||||
|
res->fast_mode = 0;
|
||||||
|
res->num_fast_bytes = 8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
res->dict_size = 256 * 1024;
|
||||||
|
res->fast_mode = 0;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
res->dict_size = 8 * 1024 * 1024;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
res->dict_size = src_len;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cconf overrides
|
||||||
|
if (lcconf)
|
||||||
|
{
|
||||||
|
oassign(res->pos_bits, lcconf->pos_bits);
|
||||||
|
oassign(res->lit_pos_bits, lcconf->lit_pos_bits);
|
||||||
|
oassign(res->lit_context_bits, lcconf->lit_context_bits);
|
||||||
|
oassign(res->dict_size, lcconf->dict_size);
|
||||||
|
oassign(res->num_fast_bytes, lcconf->num_fast_bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// limit dictionary size
|
||||||
|
if (res->dict_size > src_len)
|
||||||
|
res->dict_size = src_len;
|
||||||
|
|
||||||
|
// limit num_probs
|
||||||
|
if (lcconf && lcconf->max_num_probs)
|
||||||
|
{
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
unsigned n = 1846 + (768u << (res->lit_context_bits + res->lit_pos_bits));
|
||||||
|
if (n <= lcconf->max_num_probs)
|
||||||
|
break;
|
||||||
|
if (res->lit_pos_bits > res->lit_context_bits)
|
||||||
|
{
|
||||||
|
if (res->lit_pos_bits == 0)
|
||||||
|
goto error;
|
||||||
|
res->lit_pos_bits -= 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (res->lit_context_bits == 0)
|
||||||
|
goto error;
|
||||||
|
res->lit_context_bits -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lzma_compress_config_t::pos_bits_t::assertValue(res->pos_bits);
|
||||||
|
lzma_compress_config_t::lit_pos_bits_t::assertValue(res->lit_pos_bits);
|
||||||
|
lzma_compress_config_t::lit_context_bits_t::assertValue(res->lit_context_bits);
|
||||||
|
lzma_compress_config_t::dict_size_t::assertValue(res->dict_size);
|
||||||
|
lzma_compress_config_t::num_fast_bytes_t::assertValue(res->num_fast_bytes);
|
||||||
|
|
||||||
|
res->num_probs = 1846 + (768u << (res->lit_context_bits + res->lit_pos_bits));
|
||||||
|
//printf("\nlzma_compress config: %u %u %u %u %u\n", res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// compress - cruft because of pseudo-COM layer
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#undef MSDOS
|
||||||
|
#undef OS2
|
||||||
|
#undef _WIN32
|
||||||
|
#undef _WIN32_WCE
|
||||||
|
#undef COMPRESS_MF_MT
|
||||||
|
#undef _NO_EXCEPTIONS
|
||||||
|
#undef NULL
|
||||||
|
#define NULL nullptr
|
||||||
|
#include <lzma-sdk/C/Common/MyInitGuid.h>
|
||||||
|
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.h>
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.h>
|
||||||
|
|
||||||
|
namespace MyLzma {
|
||||||
|
|
||||||
|
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
||||||
|
{
|
||||||
|
virtual ~InStream() { }
|
||||||
|
MY_UNKNOWN_IMP
|
||||||
|
const Byte *b_buf; size_t b_size; size_t b_pos;
|
||||||
|
void Init(const Byte *data, size_t size) {
|
||||||
|
b_buf = data; b_size = size; b_pos = 0;
|
||||||
|
}
|
||||||
|
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||||
|
{
|
||||||
|
size_t remain = b_size - b_pos;
|
||||||
|
if (size > remain) size = (UInt32) remain;
|
||||||
|
memmove(data, b_buf + b_pos, size);
|
||||||
|
b_pos += size;
|
||||||
|
if (processedSize != nullptr) *processedSize = size;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
||||||
|
{
|
||||||
|
virtual ~OutStream() { }
|
||||||
|
MY_UNKNOWN_IMP
|
||||||
|
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
||||||
|
void Init(Byte *data, size_t size) {
|
||||||
|
b_buf = data; b_size = size; b_pos = 0; overflow = false;
|
||||||
|
}
|
||||||
|
HRESULT WriteByte(Byte c) {
|
||||||
|
if (b_pos >= b_size) { overflow = true; return E_FAIL; }
|
||||||
|
b_buf[b_pos++] = c;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||||
|
{
|
||||||
|
size_t remain = b_size - b_pos;
|
||||||
|
if (size > remain) size = (UInt32) remain, overflow = true;
|
||||||
|
memmove(b_buf + b_pos, data, size);
|
||||||
|
b_pos += size;
|
||||||
|
if (processedSize != nullptr) *processedSize = size;
|
||||||
|
return overflow ? E_FAIL : S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
|
{
|
||||||
|
virtual ~ProgressInfo() { }
|
||||||
|
MY_UNKNOWN_IMP
|
||||||
|
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize) override;
|
||||||
|
upx_callback_p cb;
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||||
|
{
|
||||||
|
if (cb && cb->nprogress)
|
||||||
|
cb->nprogress(cb, (unsigned) *inSize, (unsigned) *outSize);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#include <lzma-sdk/C/Common/Alloc.cpp>
|
||||||
|
#include <lzma-sdk/C/Common/CRC.cpp>
|
||||||
|
//#include <lzma-sdk/C/7zip/Common/InBuffer.cpp>
|
||||||
|
#include <lzma-sdk/C/7zip/Common/OutBuffer.cpp>
|
||||||
|
#include <lzma-sdk/C/7zip/Common/StreamUtils.cpp>
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/LZ/LZInWindow.cpp>
|
||||||
|
//#include <lzma-sdk/C/7zip/Compress/LZ/LZOutWindow.cpp>
|
||||||
|
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.cpp>
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.cpp>
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp>
|
||||||
|
#undef RC_NORMALIZE
|
||||||
|
|
||||||
|
|
||||||
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf_parm,
|
||||||
|
upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(M_IS_LZMA(method));
|
||||||
|
assert(level > 0); assert(cresult != nullptr);
|
||||||
|
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
HRESULT rh;
|
||||||
|
const lzma_compress_config_t *lcconf = cconf_parm ? &cconf_parm->conf_lzma : nullptr;
|
||||||
|
lzma_compress_result_t *res = &cresult->result_lzma;
|
||||||
|
|
||||||
|
MyLzma::InStream is; is.AddRef();
|
||||||
|
MyLzma::OutStream os; os.AddRef();
|
||||||
|
is.Init(src, src_len);
|
||||||
|
os.Init(dst, *dst_len);
|
||||||
|
|
||||||
|
MyLzma::ProgressInfo progress; progress.AddRef();
|
||||||
|
progress.cb = cb;
|
||||||
|
|
||||||
|
NCompress::NLZMA::CEncoder enc;
|
||||||
|
const PROPID propIDs[8] = {
|
||||||
|
NCoderPropID::kPosStateBits, // 0 pb _posStateBits(2)
|
||||||
|
NCoderPropID::kLitPosBits, // 1 lp _numLiteralPosStateBits(0)
|
||||||
|
NCoderPropID::kLitContextBits, // 2 lc _numLiteralContextBits(3)
|
||||||
|
NCoderPropID::kDictionarySize, // 3 ds
|
||||||
|
NCoderPropID::kAlgorithm, // 4 fm _fastmode
|
||||||
|
NCoderPropID::kNumFastBytes, // 5 fb
|
||||||
|
NCoderPropID::kMatchFinderCycles, // 6 mfc _matchFinderCycles, _cutValue
|
||||||
|
NCoderPropID::kMatchFinder // 7 mf
|
||||||
|
};
|
||||||
|
PROPVARIANT pr[8];
|
||||||
|
const unsigned nprops = 8;
|
||||||
|
static const wchar_t matchfinder[] = L"BT4";
|
||||||
|
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
||||||
|
pr[7].vt = VT_BSTR; pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
|
||||||
|
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
||||||
|
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||||
|
if (prepare(res, src_len, method, level, lcconf) != 0)
|
||||||
|
goto error;
|
||||||
|
pr[0].uintVal = res->pos_bits;
|
||||||
|
pr[1].uintVal = res->lit_pos_bits;
|
||||||
|
pr[2].uintVal = res->lit_context_bits;
|
||||||
|
pr[3].uintVal = res->dict_size;
|
||||||
|
pr[4].uintVal = res->fast_mode;
|
||||||
|
pr[5].uintVal = res->num_fast_bytes;
|
||||||
|
pr[6].uintVal = res->match_finder_cycles;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
|
||||||
|
goto error;
|
||||||
|
if (enc.WriteCoderProperties(&os) != S_OK)
|
||||||
|
goto error;
|
||||||
|
if (os.overflow) {
|
||||||
|
//r = UPX_E_OUTPUT_OVERRUN;
|
||||||
|
r = UPX_E_NOT_COMPRESSIBLE;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
assert(os.b_pos == 5);
|
||||||
|
os.b_pos = 0;
|
||||||
|
// extra stuff in first byte: 5 high bits convenience for stub decompressor
|
||||||
|
unsigned t = res->lit_context_bits + res->lit_pos_bits;
|
||||||
|
os.WriteByte(Byte((t << 3) | res->pos_bits));
|
||||||
|
os.WriteByte(Byte((res->lit_pos_bits << 4) | (res->lit_context_bits)));
|
||||||
|
|
||||||
|
rh = enc.Code(&is, &os, nullptr, nullptr, &progress);
|
||||||
|
|
||||||
|
} catch (...) {
|
||||||
|
rh = E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(is.b_pos <= src_len);
|
||||||
|
assert(os.b_pos <= *dst_len);
|
||||||
|
if (rh == E_OUTOFMEMORY)
|
||||||
|
r = UPX_E_OUT_OF_MEMORY;
|
||||||
|
else if (os.overflow)
|
||||||
|
{
|
||||||
|
assert(os.b_pos == *dst_len);
|
||||||
|
//r = UPX_E_OUTPUT_OVERRUN;
|
||||||
|
r = UPX_E_NOT_COMPRESSIBLE;
|
||||||
|
}
|
||||||
|
else if (rh == S_OK)
|
||||||
|
{
|
||||||
|
assert(is.b_pos == src_len);
|
||||||
|
r = UPX_E_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
*dst_len = (unsigned) os.b_pos;
|
||||||
|
//printf("\nlzma_compress: %d: %u %u %u %u %u, %u - > %u\n", r, res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs, src_len, *dst_len);
|
||||||
|
//printf("%u %u %u\n", is.__m_RefCount, os.__m_RefCount, progress.__m_RefCount);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// decompress
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#undef _LZMA_IN_CB
|
||||||
|
#undef _LZMA_OUT_READ
|
||||||
|
#undef _LZMA_PROB32
|
||||||
|
#undef _LZMA_LOC_OPT
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/LZMA_C/LzmaDecode.h>
|
||||||
|
#include <lzma-sdk/C/7zip/Compress/LZMA_C/LzmaDecode.c>
|
||||||
|
|
||||||
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(M_IS_LZMA(method));
|
||||||
|
// see res->num_probs above
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(CProb) == 2)
|
||||||
|
COMPILE_TIME_ASSERT(LZMA_BASE_SIZE == 1846)
|
||||||
|
COMPILE_TIME_ASSERT(LZMA_LIT_SIZE == 768)
|
||||||
|
|
||||||
|
CLzmaDecoderState s; memset(&s, 0, sizeof(s));
|
||||||
|
SizeT src_out = 0, dst_out = 0;
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
int rh;
|
||||||
|
|
||||||
|
if (src_len < 3)
|
||||||
|
goto error;
|
||||||
|
s.Properties.pb = src[0] & 7;
|
||||||
|
s.Properties.lp = (src[1] >> 4);
|
||||||
|
s.Properties.lc = src[1] & 15;
|
||||||
|
if (s.Properties.pb >= 5) goto error;
|
||||||
|
if (s.Properties.lp >= 5) goto error;
|
||||||
|
if (s.Properties.lc >= 9) goto error;
|
||||||
|
// extra
|
||||||
|
if ((src[0] >> 3) != s.Properties.lc + s.Properties.lp) goto error;
|
||||||
|
src += 2; src_len -= 2;
|
||||||
|
|
||||||
|
if (cresult)
|
||||||
|
{
|
||||||
|
assert(cresult->method == method);
|
||||||
|
assert(cresult->result_lzma.pos_bits == (unsigned) s.Properties.pb);
|
||||||
|
assert(cresult->result_lzma.lit_pos_bits == (unsigned) s.Properties.lp);
|
||||||
|
assert(cresult->result_lzma.lit_context_bits == (unsigned) s.Properties.lc);
|
||||||
|
assert(cresult->result_lzma.num_probs == (unsigned) LzmaGetNumProbs(&s.Properties));
|
||||||
|
const lzma_compress_result_t *res = &cresult->result_lzma;
|
||||||
|
UNUSED(res);
|
||||||
|
//printf("\nlzma_decompress config: %u %u %u %u %u\n", res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs);
|
||||||
|
}
|
||||||
|
s.Probs = (CProb *) malloc(sizeof(CProb) * LzmaGetNumProbs(&s.Properties));
|
||||||
|
if (!s.Probs)
|
||||||
|
{
|
||||||
|
r = UPX_E_OUT_OF_MEMORY;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
rh = LzmaDecode(&s, src, src_len, &src_out, dst, *dst_len, &dst_out);
|
||||||
|
assert(src_out <= src_len);
|
||||||
|
assert(dst_out <= *dst_len);
|
||||||
|
if (rh == 0)
|
||||||
|
{
|
||||||
|
r = UPX_E_OK;
|
||||||
|
if (src_out != src_len)
|
||||||
|
r = UPX_E_INPUT_NOT_CONSUMED;
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
*dst_len = dst_out;
|
||||||
|
free(s.Probs);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// test_overlap - see <ucl/ucl.h> for semantics
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_lzma_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(M_IS_LZMA(method));
|
||||||
|
|
||||||
|
MemBuffer b(src_off + src_len);
|
||||||
|
memcpy(b + src_off, buf + src_off, src_len);
|
||||||
|
unsigned saved_dst_len = *dst_len;
|
||||||
|
int r = upx_lzma_decompress(b + src_off, src_len, b, dst_len, method, cresult);
|
||||||
|
if (r != UPX_E_OK)
|
||||||
|
return r;
|
||||||
|
if (*dst_len != saved_dst_len)
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
// NOTE: there is a very tiny possibility that decompression has
|
||||||
|
// succeeded but the data is not restored correctly because of
|
||||||
|
// in-place buffer overlapping, so we use an extra memcmp().
|
||||||
|
if (tbuf != nullptr && memcmp(tbuf, b, *dst_len) != 0)
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
return UPX_E_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// misc
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_lzma_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *upx_lzma_version_string(void)
|
||||||
|
{
|
||||||
|
#if (WITH_LZMA == 0x443)
|
||||||
|
return "4.43";
|
||||||
|
#else
|
||||||
|
# error "unknown WITH_LZMA version"
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
@@ -0,0 +1,340 @@
|
|||||||
|
/* compress_ucl.cpp --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
static int convert_errno_from_ucl(int r)
|
||||||
|
{
|
||||||
|
switch (r)
|
||||||
|
{
|
||||||
|
case UCL_E_OK: return UPX_E_OK;
|
||||||
|
case UCL_E_ERROR: return UPX_E_ERROR;
|
||||||
|
case UCL_E_OUT_OF_MEMORY: return UPX_E_OUT_OF_MEMORY;
|
||||||
|
case UCL_E_NOT_COMPRESSIBLE: return UPX_E_NOT_COMPRESSIBLE;
|
||||||
|
case UCL_E_INPUT_OVERRUN: return UPX_E_INPUT_OVERRUN;
|
||||||
|
case UCL_E_OUTPUT_OVERRUN: return UPX_E_OUTPUT_OVERRUN;
|
||||||
|
case UCL_E_LOOKBEHIND_OVERRUN: return UPX_E_LOOKBEHIND_OVERRUN;
|
||||||
|
case UCL_E_EOF_NOT_FOUND: return UPX_E_EOF_NOT_FOUND;
|
||||||
|
case UCL_E_INPUT_NOT_CONSUMED: return UPX_E_INPUT_NOT_CONSUMED;
|
||||||
|
// case UCL_E_NOT_YET_IMPLEMENTED: return UPX_E_NOT_YET_IMPLEMENTED;
|
||||||
|
case UCL_E_INVALID_ARGUMENT: return UPX_E_INVALID_ARGUMENT;
|
||||||
|
// UCL extra:
|
||||||
|
case UCL_E_OVERLAP_OVERRUN: return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static void __UCL_CDECL wrap_nprogress_ucl(ucl_uint a, ucl_uint b, int state, ucl_voidp user)
|
||||||
|
{
|
||||||
|
if (state != -1 && state != 3) return;
|
||||||
|
upx_callback_p cb = (upx_callback_p) user;
|
||||||
|
if (cb && cb->nprogress)
|
||||||
|
cb->nprogress(cb, a, b);
|
||||||
|
}}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb_parm,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf_parm,
|
||||||
|
upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
assert(level > 0); assert(cresult != nullptr);
|
||||||
|
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(ucl_compress_config_t) == sizeof(REAL_ucl_compress_config_t))
|
||||||
|
|
||||||
|
ucl_progress_callback_t cb;
|
||||||
|
cb.callback = nullptr;
|
||||||
|
cb.user = nullptr;
|
||||||
|
if (cb_parm && cb_parm->nprogress) {
|
||||||
|
cb.callback = wrap_nprogress_ucl;
|
||||||
|
cb.user = cb_parm;
|
||||||
|
}
|
||||||
|
|
||||||
|
ucl_compress_config_t cconf; cconf.reset();
|
||||||
|
if (cconf_parm)
|
||||||
|
memcpy(&cconf, &cconf_parm->conf_ucl, sizeof(cconf)); // cconf = cconf_parm->conf_ucl; // struct copy
|
||||||
|
|
||||||
|
ucl_uint *res = cresult->result_ucl.result;
|
||||||
|
// assume no info available - fill in worst case results
|
||||||
|
//res[0] = 1; // min_offset_found - NOT USED
|
||||||
|
res[1] = src_len - 1; // max_offset_found
|
||||||
|
//res[2] = 2; // min_match_found - NOT USED
|
||||||
|
res[3] = src_len - 1; // max_match_found
|
||||||
|
//res[4] = 1; // min_run_found - NOT USED
|
||||||
|
res[5] = src_len; // max_run_found
|
||||||
|
res[6] = 1; // first_offset_found
|
||||||
|
//res[7] = 999999; // same_match_offsets_found - NOT USED
|
||||||
|
|
||||||
|
// prepare bit-buffer settings
|
||||||
|
cconf.bb_endian = 0;
|
||||||
|
cconf.bb_size = 0;
|
||||||
|
if (method >= M_NRV2B_LE32 && method <= M_NRV2E_LE16)
|
||||||
|
{
|
||||||
|
static const unsigned char sizes[3] = {32, 8, 16};
|
||||||
|
cconf.bb_size = sizes[(method - M_NRV2B_LE32) % 3];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throwInternalError("unknown compression method");
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// optimize compression parms
|
||||||
|
if (level <= 3 && cconf.max_offset == UCL_UINT_MAX)
|
||||||
|
cconf.max_offset = 8*1024-1;
|
||||||
|
else if (level == 4 && cconf.max_offset == UCL_UINT_MAX)
|
||||||
|
cconf.max_offset = 32*1024-1;
|
||||||
|
|
||||||
|
if M_IS_NRV2B(method)
|
||||||
|
r = ucl_nrv2b_99_compress(src, src_len, dst, dst_len,
|
||||||
|
&cb, level, &cconf, res);
|
||||||
|
else if M_IS_NRV2D(method)
|
||||||
|
r = ucl_nrv2d_99_compress(src, src_len, dst, dst_len,
|
||||||
|
&cb, level, &cconf, res);
|
||||||
|
else if M_IS_NRV2E(method)
|
||||||
|
r = ucl_nrv2e_99_compress(src, src_len, dst, dst_len,
|
||||||
|
&cb, level, &cconf, res);
|
||||||
|
else {
|
||||||
|
throwInternalError("unknown compression method");
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure first_offset_found is set
|
||||||
|
if (res[6] == 0)
|
||||||
|
res[6] = 1;
|
||||||
|
|
||||||
|
return convert_errno_from_ucl(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
switch (method)
|
||||||
|
{
|
||||||
|
case M_NRV2B_8:
|
||||||
|
r = ucl_nrv2b_decompress_safe_8(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2B_LE16:
|
||||||
|
r = ucl_nrv2b_decompress_safe_le16(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2B_LE32:
|
||||||
|
r = ucl_nrv2b_decompress_safe_le32(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_8:
|
||||||
|
r = ucl_nrv2d_decompress_safe_8(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_LE16:
|
||||||
|
r = ucl_nrv2d_decompress_safe_le16(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_LE32:
|
||||||
|
r = ucl_nrv2d_decompress_safe_le32(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_8:
|
||||||
|
r = ucl_nrv2e_decompress_safe_8(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_LE16:
|
||||||
|
r = ucl_nrv2e_decompress_safe_le16(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_LE32:
|
||||||
|
r = ucl_nrv2e_decompress_safe_le32(src,src_len,dst,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throwInternalError("unknown decompression method");
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNUSED(cresult);
|
||||||
|
return convert_errno_from_ucl(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_ucl_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
UNUSED(tbuf); // not needed for UCL
|
||||||
|
|
||||||
|
switch (method)
|
||||||
|
{
|
||||||
|
case M_NRV2B_8:
|
||||||
|
r = ucl_nrv2b_test_overlap_8(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2B_LE16:
|
||||||
|
r = ucl_nrv2b_test_overlap_le16(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2B_LE32:
|
||||||
|
r = ucl_nrv2b_test_overlap_le32(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_8:
|
||||||
|
r = ucl_nrv2d_test_overlap_8(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_LE16:
|
||||||
|
r = ucl_nrv2d_test_overlap_le16(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2D_LE32:
|
||||||
|
r = ucl_nrv2d_test_overlap_le32(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_8:
|
||||||
|
r = ucl_nrv2e_test_overlap_8(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_LE16:
|
||||||
|
r = ucl_nrv2e_test_overlap_le16(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
case M_NRV2E_LE32:
|
||||||
|
r = ucl_nrv2e_test_overlap_le32(buf,src_off,src_len,dst_len,nullptr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throwInternalError("unknown decompression method");
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
UNUSED(cresult);
|
||||||
|
return convert_errno_from_ucl(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// misc
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
static ucl_voidp __UCL_CDECL my_malloc(ucl_uint n) { return calloc(1, n); }
|
||||||
|
static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
|
||||||
|
}
|
||||||
|
|
||||||
|
int upx_ucl_init(void)
|
||||||
|
{
|
||||||
|
if (ucl_init() != UCL_E_OK)
|
||||||
|
return -1;
|
||||||
|
if (UCL_VERSION != ucl_version() || strcmp(UCL_VERSION_STRING, ucl_version_string()) != 0)
|
||||||
|
return -2;
|
||||||
|
ucl_set_malloc_hooks(my_malloc, my_free);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *upx_ucl_version_string(void)
|
||||||
|
{
|
||||||
|
return ucl_version_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
|
{
|
||||||
|
return ucl_adler32(adler, (const ucl_bytep) buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_ucl_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
|
{
|
||||||
|
return ucl_crc32(crc, (const ucl_bytep) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// Debug checks
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if DEBUG && 1
|
||||||
|
|
||||||
|
#include "util/membuffer.h"
|
||||||
|
|
||||||
|
static bool check_ucl(const int method, const unsigned expected_c_len) {
|
||||||
|
const unsigned u_len = 16384;
|
||||||
|
const unsigned c_extra = 4096;
|
||||||
|
MemBuffer u_buf, c_buf, d_buf;
|
||||||
|
unsigned c_len, d_len;
|
||||||
|
upx_compress_result_t cresult;
|
||||||
|
int r;
|
||||||
|
const int level = 3; // don't waste time
|
||||||
|
|
||||||
|
u_buf.alloc(u_len);
|
||||||
|
memset(u_buf, 0, u_len);
|
||||||
|
c_buf.allocForCompression(u_len, c_extra);
|
||||||
|
d_buf.allocForUncompression(u_len);
|
||||||
|
|
||||||
|
c_len = c_buf.getSize() - c_extra;
|
||||||
|
r = upx_ucl_compress(u_buf, u_len, c_buf + c_extra, &c_len, nullptr, method, level, NULL_cconf, &cresult);
|
||||||
|
if (r != 0 || c_len != expected_c_len) return false;
|
||||||
|
|
||||||
|
d_len = d_buf.getSize();
|
||||||
|
r = upx_ucl_decompress(c_buf + c_extra, c_len, d_buf, &d_len, method, nullptr);
|
||||||
|
if (r != 0 || d_len != u_len) return false;
|
||||||
|
if (memcmp(u_buf, d_buf, u_len) != 0) return false;
|
||||||
|
|
||||||
|
// TODO: rewrite Packer::findOverlapOverhead() so that we can test it here
|
||||||
|
//unsigned x_len = d_len;
|
||||||
|
//r = upx_ucl_test_overlap(c_buf, u_buf, c_extra, c_len, &x_len, method, nullptr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("compress_ucl") {
|
||||||
|
CHECK(check_ucl(M_NRV2B_8, 34));
|
||||||
|
CHECK(check_ucl(M_NRV2B_LE16, 34));
|
||||||
|
CHECK(check_ucl(M_NRV2B_LE32, 34));
|
||||||
|
CHECK(check_ucl(M_NRV2D_8, 32));
|
||||||
|
CHECK(check_ucl(M_NRV2D_LE16, 32));
|
||||||
|
CHECK(check_ucl(M_NRV2D_LE32, 34));
|
||||||
|
CHECK(check_ucl(M_NRV2E_8, 32));
|
||||||
|
CHECK(check_ucl(M_NRV2E_LE16, 32));
|
||||||
|
CHECK(check_ucl(M_NRV2E_LE32, 34));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
/* compress_zlib.cpp --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
|
#include "util/membuffer.h"
|
||||||
|
#include <zlib/zlib.h>
|
||||||
|
#include <zlib/deflate.h>
|
||||||
|
|
||||||
|
|
||||||
|
void zlib_compress_config_t::reset()
|
||||||
|
{
|
||||||
|
mem_clear(this, sizeof(*this));
|
||||||
|
|
||||||
|
mem_level.reset();
|
||||||
|
window_bits.reset();
|
||||||
|
strategy.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int convert_errno_from_zlib(int zr)
|
||||||
|
{
|
||||||
|
switch (zr)
|
||||||
|
{
|
||||||
|
case Z_OK: return UPX_E_OK;
|
||||||
|
case Z_DATA_ERROR: return UPX_E_ERROR;
|
||||||
|
case Z_NEED_DICT: return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
upx_callback_p cb_parm,
|
||||||
|
int method, int level,
|
||||||
|
const upx_compress_config_t *cconf_parm,
|
||||||
|
upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(method == M_DEFLATE);
|
||||||
|
assert(level > 0); assert(cresult != nullptr);
|
||||||
|
UNUSED(cb_parm);
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
int zr;
|
||||||
|
const zlib_compress_config_t *lcconf = cconf_parm ? &cconf_parm->conf_zlib : nullptr;
|
||||||
|
zlib_compress_result_t *res = &cresult->result_zlib;
|
||||||
|
|
||||||
|
if (level == 10)
|
||||||
|
level = 9;
|
||||||
|
|
||||||
|
zlib_compress_config_t::mem_level_t mem_level;
|
||||||
|
zlib_compress_config_t::window_bits_t window_bits;
|
||||||
|
zlib_compress_config_t::strategy_t strategy;
|
||||||
|
// cconf overrides
|
||||||
|
if (lcconf)
|
||||||
|
{
|
||||||
|
oassign(mem_level, lcconf->mem_level);
|
||||||
|
oassign(window_bits, lcconf->window_bits);
|
||||||
|
oassign(strategy, lcconf->strategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
res->dummy = 0;
|
||||||
|
|
||||||
|
z_stream s;
|
||||||
|
s.zalloc = (alloc_func) nullptr;
|
||||||
|
s.zfree = (free_func) nullptr;
|
||||||
|
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
|
||||||
|
s.avail_in = src_len;
|
||||||
|
s.next_out = dst;
|
||||||
|
s.avail_out = *dst_len;
|
||||||
|
s.total_in = s.total_out = 0;
|
||||||
|
|
||||||
|
zr = (int)deflateInit2(&s, level, Z_DEFLATED, 0 - (int)window_bits,
|
||||||
|
mem_level, strategy);
|
||||||
|
if (zr != Z_OK)
|
||||||
|
goto error;
|
||||||
|
assert(s.state->level == level);
|
||||||
|
zr = deflate(&s, Z_FINISH);
|
||||||
|
if (zr != Z_STREAM_END)
|
||||||
|
goto error;
|
||||||
|
zr = deflateEnd(&s);
|
||||||
|
if (zr != Z_OK)
|
||||||
|
goto error;
|
||||||
|
r = UPX_E_OK;
|
||||||
|
goto done;
|
||||||
|
error:
|
||||||
|
(void) deflateEnd(&s);
|
||||||
|
r = convert_errno_from_zlib(zr);
|
||||||
|
if (r == UPX_E_OK)
|
||||||
|
r = UPX_E_ERROR;
|
||||||
|
done:
|
||||||
|
if (r == UPX_E_OK)
|
||||||
|
{
|
||||||
|
if (s.avail_in != 0 || s.total_in != src_len)
|
||||||
|
r = UPX_E_ERROR;
|
||||||
|
}
|
||||||
|
assert(s.total_in <= src_len);
|
||||||
|
assert(s.total_out <= *dst_len);
|
||||||
|
*dst_len = s.total_out;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_zlib_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(method == M_DEFLATE);
|
||||||
|
UNUSED(method);
|
||||||
|
UNUSED(cresult);
|
||||||
|
int r = UPX_E_ERROR;
|
||||||
|
int zr;
|
||||||
|
|
||||||
|
z_stream s;
|
||||||
|
s.zalloc = (alloc_func) nullptr;
|
||||||
|
s.zfree = (free_func) nullptr;
|
||||||
|
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
|
||||||
|
s.avail_in = src_len;
|
||||||
|
s.next_out = dst;
|
||||||
|
s.avail_out = *dst_len;
|
||||||
|
s.total_in = s.total_out = 0;
|
||||||
|
|
||||||
|
zr = inflateInit2(&s, -15);
|
||||||
|
if (zr != Z_OK)
|
||||||
|
goto error;
|
||||||
|
zr = inflate(&s, Z_FINISH);
|
||||||
|
if (zr != Z_STREAM_END)
|
||||||
|
goto error;
|
||||||
|
zr = inflateEnd(&s);
|
||||||
|
if (zr != Z_OK)
|
||||||
|
goto error;
|
||||||
|
r = UPX_E_OK;
|
||||||
|
goto done;
|
||||||
|
error:
|
||||||
|
(void) inflateEnd(&s);
|
||||||
|
r = convert_errno_from_zlib(zr);
|
||||||
|
if (r == UPX_E_OK)
|
||||||
|
r = UPX_E_ERROR;
|
||||||
|
done:
|
||||||
|
if (r == UPX_E_OK)
|
||||||
|
{
|
||||||
|
if (s.avail_in != 0 || s.total_in != src_len)
|
||||||
|
r = UPX_E_INPUT_NOT_CONSUMED;
|
||||||
|
}
|
||||||
|
assert(s.total_in <= src_len);
|
||||||
|
assert(s.total_out <= *dst_len);
|
||||||
|
*dst_len = s.total_out;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// test_overlap - see <ucl/ucl.h> for semantics
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_zlib_test_overlap ( const upx_bytep buf,
|
||||||
|
const upx_bytep tbuf,
|
||||||
|
unsigned src_off, unsigned src_len,
|
||||||
|
unsigned* dst_len,
|
||||||
|
int method,
|
||||||
|
const upx_compress_result_t *cresult )
|
||||||
|
{
|
||||||
|
assert(method == M_DEFLATE);
|
||||||
|
|
||||||
|
MemBuffer b(src_off + src_len);
|
||||||
|
memcpy(b + src_off, buf + src_off, src_len);
|
||||||
|
unsigned saved_dst_len = *dst_len;
|
||||||
|
int r = upx_zlib_decompress(b + src_off, src_len, b, dst_len, method, cresult);
|
||||||
|
if (r != UPX_E_OK)
|
||||||
|
return r;
|
||||||
|
if (*dst_len != saved_dst_len)
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
// NOTE: there is a very tiny possibility that decompression has
|
||||||
|
// succeeded but the data is not restored correctly because of
|
||||||
|
// in-place buffer overlapping, so we use an extra memcmp().
|
||||||
|
if (tbuf != nullptr && memcmp(tbuf, b, *dst_len) != 0)
|
||||||
|
return UPX_E_ERROR;
|
||||||
|
return UPX_E_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// misc
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int upx_zlib_init(void)
|
||||||
|
{
|
||||||
|
if (strcmp(ZLIB_VERSION, zlibVersion()) != 0)
|
||||||
|
return -2;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *upx_zlib_version_string(void)
|
||||||
|
{
|
||||||
|
return zlibVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
|
{
|
||||||
|
return adler32(adler, (const Bytef *) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0 /* UNUSED */
|
||||||
|
unsigned upx_zlib_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
|
{
|
||||||
|
return crc32(crc, (const Bytef *) buf, len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// Debug checks
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if DEBUG && 1
|
||||||
|
|
||||||
|
#include "util/membuffer.h"
|
||||||
|
|
||||||
|
static bool check_zlib(const int method, const int level, const unsigned expected_c_len) {
|
||||||
|
const unsigned u_len = 16384;
|
||||||
|
const unsigned c_extra = 4096;
|
||||||
|
MemBuffer u_buf, c_buf, d_buf;
|
||||||
|
unsigned c_len, d_len;
|
||||||
|
upx_compress_result_t cresult;
|
||||||
|
int r;
|
||||||
|
|
||||||
|
u_buf.alloc(u_len);
|
||||||
|
memset(u_buf, 0, u_len);
|
||||||
|
c_buf.allocForCompression(u_len, c_extra);
|
||||||
|
d_buf.allocForUncompression(u_len);
|
||||||
|
|
||||||
|
c_len = c_buf.getSize() - c_extra;
|
||||||
|
r = upx_zlib_compress(u_buf, u_len, c_buf + c_extra, &c_len, nullptr, method, level, NULL_cconf, &cresult);
|
||||||
|
if (r != 0 || c_len != expected_c_len) return false;
|
||||||
|
|
||||||
|
d_len = d_buf.getSize();
|
||||||
|
r = upx_zlib_decompress(c_buf + c_extra, c_len, d_buf, &d_len, method, nullptr);
|
||||||
|
if (r != 0 || d_len != u_len) return false;
|
||||||
|
if (memcmp(u_buf, d_buf, u_len) != 0) return false;
|
||||||
|
|
||||||
|
// TODO: rewrite Packer::findOverlapOverhead() so that we can test it here
|
||||||
|
//unsigned x_len = d_len;
|
||||||
|
//r = upx_zlib_test_overlap(c_buf, u_buf, c_extra, c_len, &x_len, method, nullptr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("compress_zlib") {
|
||||||
|
CHECK(check_zlib(M_DEFLATE, 1, 89));
|
||||||
|
CHECK(check_zlib(M_DEFLATE, 3, 89));
|
||||||
|
CHECK(check_zlib(M_DEFLATE, 5, 33));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // DEBUG
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
+577
-329
File diff suppressed because it is too large
Load Diff
+26
-35
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -39,41 +39,41 @@
|
|||||||
#undef USE_SCREEN_WIN32
|
#undef USE_SCREEN_WIN32
|
||||||
#undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
|
|
||||||
#if defined(WITH_GUI) && !defined(NO_CONSOLE)
|
#if 1 && (WITH_GUI) && !defined(NO_CONSOLE)
|
||||||
# define NO_CONSOLE
|
# define NO_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__linux__)
|
#if 1 && defined(__linux__)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_VCSA
|
# define USE_SCREEN_VCSA 1
|
||||||
# if !defined(HAVE_LINUX_KD_H)
|
# if !(HAVE_LINUX_KD_H)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
# undef USE_SCREEN_VCSA
|
||||||
# endif
|
# endif
|
||||||
# if !defined(HAVE_LINUX_KDEV_T_H) || !defined(HAVE_LINUX_MAJOR_H)
|
# if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
# undef USE_SCREEN_VCSA
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__DJGPP__)
|
#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32
|
# define USE_SCREEN_WIN32 1
|
||||||
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32
|
# define USE_SCREEN_WIN32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || defined(NO_ANSI)
|
#if 0 || (NO_ANSI)
|
||||||
# undef USE_ANSI
|
# undef USE_ANSI
|
||||||
#endif
|
#endif
|
||||||
#if 0 || defined(NO_SCREEN)
|
#if 0 || (NO_SCREEN)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
#endif
|
#endif
|
||||||
#if 0 || defined(NO_FRAMES) || !defined(USE_SCREEN)
|
#if 0 || (NO_FRAMES) || !(USE_SCREEN)
|
||||||
# undef USE_FRAMES
|
# undef USE_FRAMES
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
@@ -81,11 +81,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || defined(USE_ANSI) || defined(USE_SCREEN)
|
#if 0 || (USE_ANSI) || (USE_SCREEN)
|
||||||
# define USE_CONSOLE
|
# define USE_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 || defined(NO_CONSOLE) || !defined(USE_CONSOLE)
|
#if 0 || (NO_CONSOLE) || !(USE_CONSOLE)
|
||||||
# undef USE_CONSOLE
|
# undef USE_CONSOLE
|
||||||
# undef USE_ANSI
|
# undef USE_ANSI
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
@@ -110,24 +110,19 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int (*init)(FILE *f, int, int);
|
int (*init)(FILE *f, int, int);
|
||||||
int (*set_fg)(FILE *f, int fg);
|
int (*set_fg)(FILE *f, int fg);
|
||||||
void (*print0)(FILE *f, const char *s);
|
void (*print0)(FILE *f, const char *s);
|
||||||
upx_bool (*intro)(FILE *f);
|
bool (*intro)(FILE *f);
|
||||||
}
|
}
|
||||||
console_t;
|
console_t;
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
void con_fprintf(FILE *f, const char *format, ...) attribute_format(2, 3);
|
||||||
void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...)
|
|
||||||
__attribute__((__format__(printf,2,3)));
|
|
||||||
#else
|
|
||||||
void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define FG_BLACK 0x00
|
#define FG_BLACK 0x00
|
||||||
@@ -165,7 +160,7 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...);
|
|||||||
|
|
||||||
extern FILE *con_term;
|
extern FILE *con_term;
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
extern int con_mode;
|
extern int con_mode;
|
||||||
extern console_t *con;
|
extern console_t *con;
|
||||||
@@ -187,8 +182,4 @@ extern console_t console_screen;
|
|||||||
|
|
||||||
#endif /* USE_CONSOLE */
|
#endif /* USE_CONSOLE */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+47
-84
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,60 +22,55 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
long Throwable::counter = 0;
|
unsigned long Throwable::counter = 0;
|
||||||
|
|
||||||
Throwable::Throwable(const char *m, int e, bool w) NOTHROW
|
Throwable::Throwable(const char *m, int e, bool w) noexcept : super(),
|
||||||
: super(), msg(NULL), err(e), is_warning(w)
|
msg(nullptr),
|
||||||
{
|
err(e),
|
||||||
|
is_warning(w) {
|
||||||
if (m)
|
if (m)
|
||||||
msg = strdup(m);
|
msg = strdup(m);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "construct exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "construct exception: %s %lu\n", msg, counter);
|
||||||
counter++;
|
counter++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Throwable::Throwable(const Throwable &other) noexcept : super(other),
|
||||||
Throwable::Throwable(const Throwable &other) NOTHROW
|
msg(nullptr),
|
||||||
: super(other), msg(NULL), err(other.err), is_warning(other.is_warning)
|
err(other.err),
|
||||||
{
|
is_warning(other.is_warning) {
|
||||||
if (other.msg)
|
if (other.msg)
|
||||||
msg = strdup(other.msg);
|
msg = strdup(other.msg);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "copy exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "copy exception: %s %lu\n", msg, counter);
|
||||||
counter++;
|
counter++;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Throwable::~Throwable() noexcept {
|
||||||
Throwable::~Throwable() NOTHROW
|
|
||||||
{
|
|
||||||
#if 0
|
#if 0
|
||||||
counter--;
|
counter--;
|
||||||
fprintf(stderr, "destruct exception: %s %ld\n", msg, counter);
|
fprintf(stderr, "destruct exception: %s %lu\n", msg, counter);
|
||||||
#endif
|
#endif
|
||||||
if (msg)
|
if (msg)
|
||||||
free(msg);
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// compression
|
// compression
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void throwCantPack(const char *msg)
|
void throwCantPack(const char *msg) {
|
||||||
{
|
|
||||||
// UGLY, but makes things easier
|
// UGLY, but makes things easier
|
||||||
if (opt->cmd == CMD_COMPRESS)
|
if (opt->cmd == CMD_COMPRESS)
|
||||||
throw CantPackException(msg);
|
throw CantPackException(msg);
|
||||||
@@ -85,106 +80,78 @@ void throwCantPack(const char *msg)
|
|||||||
throw CantUnpackException(msg);
|
throw CantUnpackException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwFilterException()
|
void throwCantPackExact() { throwCantPack("option '--exact' does not work with this file"); }
|
||||||
{
|
|
||||||
throwCantPack("filter problem");
|
|
||||||
}
|
|
||||||
|
|
||||||
void throwUnknownExecutableFormat(const char *msg, bool warn)
|
void throwFilterException() { throwCantPack("filter problem"); }
|
||||||
{
|
|
||||||
|
void throwUnknownExecutableFormat(const char *msg, bool warn) {
|
||||||
throw UnknownExecutableFormatException(msg, warn);
|
throw UnknownExecutableFormatException(msg, warn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwNotCompressible(const char *msg)
|
void throwNotCompressible(const char *msg) { throw NotCompressibleException(msg); }
|
||||||
{
|
|
||||||
throw NotCompressibleException(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void throwAlreadyPacked(const char *msg)
|
void throwAlreadyPacked(const char *msg) { throw AlreadyPackedException(msg); }
|
||||||
{
|
|
||||||
throw AlreadyPackedException(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void throwAlreadyPackedByUPX(const char *msg)
|
void throwAlreadyPackedByUPX(const char *msg) {
|
||||||
{
|
if (msg == nullptr)
|
||||||
if (msg == NULL)
|
|
||||||
msg = "already packed by UPX";
|
msg = "already packed by UPX";
|
||||||
throwAlreadyPacked(msg);
|
throwAlreadyPacked(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// decompression
|
// decompression
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void throwCantUnpack(const char *msg)
|
void throwCantUnpack(const char *msg) {
|
||||||
{
|
|
||||||
// UGLY, but makes things easier
|
// UGLY, but makes things easier
|
||||||
throwCantPack(msg);
|
throwCantPack(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwNotPacked(const char *msg)
|
void throwNotPacked(const char *msg) {
|
||||||
{
|
if (msg == nullptr)
|
||||||
if (msg == NULL)
|
|
||||||
msg = "not packed by UPX";
|
msg = "not packed by UPX";
|
||||||
throw NotPackedException(msg);
|
throw NotPackedException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwChecksumError()
|
void throwChecksumError() { throw Exception("checksum error"); }
|
||||||
{
|
|
||||||
throw Exception("checksum error");
|
|
||||||
}
|
|
||||||
|
|
||||||
void throwCompressedDataViolation()
|
|
||||||
{
|
|
||||||
throw Exception("compressed data violation");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void throwCompressedDataViolation() { throw Exception("compressed data violation"); }
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// other
|
// other
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void throwInternalError(const char *msg)
|
void throwInternalError(const char *msg) { throw InternalError(msg); }
|
||||||
{
|
|
||||||
throw InternalError(msg);
|
void throwBadLoader() { throwInternalError("bad loader"); }
|
||||||
|
|
||||||
|
void throwOutOfMemoryException(const char *msg) {
|
||||||
|
if (msg == nullptr)
|
||||||
|
msg = "out of memory";
|
||||||
|
throw OutOfMemoryException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throwBadLoader()
|
void throwIOException(const char *msg, int e) { throw IOException(msg, e); }
|
||||||
{
|
|
||||||
throwInternalError("bad loader");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void throwEOFException(const char *msg, int e) {
|
||||||
void throwIOException(const char *msg, int e)
|
if (msg == nullptr && e == 0)
|
||||||
{
|
|
||||||
throw IOException(msg, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void throwEOFException(const char *msg, int e)
|
|
||||||
{
|
|
||||||
if (msg == NULL && e == 0)
|
|
||||||
msg = "premature end of file";
|
msg = "premature end of file";
|
||||||
throw EOFException(msg, e);
|
throw EOFException(msg, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
const char *prettyName(const char *n) NOTHROW
|
const char *prettyName(const char *n) noexcept {
|
||||||
{
|
if (n == nullptr)
|
||||||
if (n == NULL)
|
|
||||||
return "(null)";
|
return "(null)";
|
||||||
while (*n)
|
while (*n) {
|
||||||
{
|
if (*n >= '0' && *n <= '9') // Linux ABI
|
||||||
if (*n >= '0' && *n <= '9') // Linux ABI
|
|
||||||
n++;
|
n++;
|
||||||
else if (*n == ' ')
|
else if (*n == ' ')
|
||||||
n++;
|
n++;
|
||||||
else if (strncmp(n, "class ", 6) == 0) // Visual C++
|
else if (strncmp(n, "class ", 6) == 0) // Visual C++
|
||||||
n += 6;
|
n += 6;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@@ -192,8 +159,4 @@ const char *prettyName(const char *n) NOTHROW
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+97
-109
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,215 +22,203 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef __UPX_EXCEPT_H
|
#ifndef UPX_EXCEPT_H__
|
||||||
#define __UPX_EXCEPT_H
|
#define UPX_EXCEPT_H__ 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
const char *prettyName(const char *n) NOTHROW;
|
const char *prettyName(const char *n) noexcept;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// exceptions
|
// exceptions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class Throwable : public std::exception
|
class Throwable : public std::exception {
|
||||||
{
|
|
||||||
typedef std::exception super;
|
typedef std::exception super;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Throwable(const char *m = 0, int e = 0, bool w = false) NOTHROW;
|
Throwable(const char *m = nullptr, int e = 0, bool w = false) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Throwable(const Throwable &) NOTHROW;
|
Throwable(const Throwable &) noexcept;
|
||||||
virtual ~Throwable() NOTHROW;
|
virtual ~Throwable() noexcept;
|
||||||
const char *getMsg() const NOTHROW { return msg; }
|
const char *getMsg() const noexcept { return msg; }
|
||||||
int getErrno() const NOTHROW { return err; }
|
int getErrno() const noexcept { return err; }
|
||||||
bool isWarning() const NOTHROW { return is_warning; }
|
bool isWarning() const noexcept { return is_warning; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char *msg;
|
char *msg = nullptr;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool is_warning; // can be set by subclasses
|
bool is_warning = false; // can be set by subclasses
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// disable assignment
|
// disable assignment
|
||||||
Throwable& operator= (const Throwable &);
|
Throwable &operator=(const Throwable &) = delete;
|
||||||
// disable dynamic allocation
|
// disable dynamic allocation => force throwing by value
|
||||||
DISABLE_NEW_DELETE
|
ACC_CXX_DISABLE_NEW_DELETE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static long counter; // for debugging
|
static unsigned long counter; // for debugging
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Exceptions can/should be caught
|
// Exceptions can/should be caught
|
||||||
class Exception : public Throwable
|
class Exception : public Throwable {
|
||||||
{
|
|
||||||
typedef Throwable super;
|
typedef Throwable super;
|
||||||
public:
|
|
||||||
Exception(const char *m = 0, int e = 0, bool w = false) NOTHROW : super(m,e,w) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
Exception(const char *m = nullptr, int e = 0, bool w = false) noexcept : super(m, e, w) {}
|
||||||
|
};
|
||||||
|
|
||||||
// Errors should not be caught (or re-thrown)
|
// Errors should not be caught (or re-thrown)
|
||||||
class Error : public Throwable
|
class Error : public Throwable {
|
||||||
{
|
|
||||||
typedef Throwable super;
|
typedef Throwable super;
|
||||||
public:
|
|
||||||
Error(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
Error(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// system exception
|
// system exception
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class OutOfMemoryException : public Exception
|
class OutOfMemoryException : public Exception {
|
||||||
{
|
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutOfMemoryException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
OutOfMemoryException(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class IOException : public Exception {
|
||||||
class IOException : public Exception
|
|
||||||
{
|
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IOException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
IOException(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class EOFException : public IOException {
|
||||||
class EOFException : public IOException
|
|
||||||
{
|
|
||||||
typedef IOException super;
|
typedef IOException super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EOFException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
EOFException(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FileNotFoundException : public IOException {
|
||||||
class FileNotFoundException : public IOException
|
|
||||||
{
|
|
||||||
typedef IOException super;
|
typedef IOException super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FileNotFoundException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
FileNotFoundException(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FileAlreadyExistsException : public IOException {
|
||||||
class FileAlreadyExistsException : public IOException
|
|
||||||
{
|
|
||||||
typedef IOException super;
|
typedef IOException super;
|
||||||
public:
|
|
||||||
FileAlreadyExistsException(const char *m = 0, int e = 0) NOTHROW : super(m,e) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
FileAlreadyExistsException(const char *m = nullptr, int e = 0) noexcept : super(m, e) {}
|
||||||
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// application execptions
|
// application exceptions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class OverlayException : public Exception
|
class OverlayException : public Exception {
|
||||||
{
|
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OverlayException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { }
|
OverlayException(const char *m = nullptr, bool w = false) noexcept : super(m, 0, w) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CantPackException : public Exception
|
class CantPackException : public Exception {
|
||||||
{
|
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CantPackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { }
|
CantPackException(const char *m = nullptr, bool w = false) noexcept : super(m, 0, w) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class UnknownExecutableFormatException : public CantPackException
|
class UnknownExecutableFormatException : public CantPackException {
|
||||||
{
|
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnknownExecutableFormatException(const char *m = 0, bool w = false) NOTHROW : super(m,w) { }
|
UnknownExecutableFormatException(const char *m = nullptr, bool w = false) noexcept
|
||||||
|
: super(m, w) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AlreadyPackedException : public CantPackException
|
class AlreadyPackedException : public CantPackException {
|
||||||
{
|
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AlreadyPackedException(const char *m = 0) NOTHROW : super(m) { is_warning = true; }
|
AlreadyPackedException(const char *m = nullptr) noexcept : super(m) { is_warning = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotCompressibleException : public CantPackException
|
class NotCompressibleException : public CantPackException {
|
||||||
{
|
|
||||||
typedef CantPackException super;
|
typedef CantPackException super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotCompressibleException(const char *m = 0) NOTHROW : super(m) { }
|
NotCompressibleException(const char *m = nullptr) noexcept : super(m) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CantUnpackException : public Exception {
|
||||||
class CantUnpackException : public Exception
|
|
||||||
{
|
|
||||||
typedef Exception super;
|
typedef Exception super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CantUnpackException(const char *m = 0, bool w = false) NOTHROW : super(m,0,w) { }
|
CantUnpackException(const char *m = nullptr, bool w = false) noexcept : super(m, 0, w) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotPackedException : public CantUnpackException
|
class NotPackedException : public CantUnpackException {
|
||||||
{
|
|
||||||
typedef CantUnpackException super;
|
typedef CantUnpackException super;
|
||||||
public:
|
|
||||||
NotPackedException(const char *m = 0) NOTHROW : super(m,true) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
NotPackedException(const char *m = nullptr) noexcept : super(m, true) {}
|
||||||
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// errors
|
// errors
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class InternalError : public Error
|
class InternalError : public Error {
|
||||||
{
|
|
||||||
typedef Error super;
|
typedef Error super;
|
||||||
public:
|
|
||||||
InternalError(const char *m = 0) NOTHROW : super(m,0) { }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
InternalError(const char *m = nullptr) noexcept : super(m, 0) {}
|
||||||
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// util
|
// util
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#undef NORET
|
#undef NORET
|
||||||
#if 0 && defined(__GNUC__)
|
#if 1 && defined(__GNUC__)
|
||||||
// (noreturn) is probably not the correct semantics for throwing exceptions
|
#define NORET __acc_noinline __attribute__((__noreturn__))
|
||||||
#define NORET __attribute__((__noreturn__))
|
|
||||||
#else
|
#else
|
||||||
#define NORET
|
#define NORET __acc_noinline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void throwCantPack(const char *msg) NORET;
|
NORET void throwCantPack(const char *msg);
|
||||||
void throwUnknownExecutableFormat(const char *msg = NULL, bool warn = false) NORET;
|
NORET void throwCantPackExact();
|
||||||
void throwNotCompressible(const char *msg = NULL) NORET;
|
NORET void throwUnknownExecutableFormat(const char *msg = nullptr, bool warn = false);
|
||||||
void throwAlreadyPacked(const char *msg = NULL) NORET;
|
NORET void throwNotCompressible(const char *msg = nullptr);
|
||||||
void throwAlreadyPackedByUPX(const char *msg = NULL) NORET;
|
NORET void throwAlreadyPacked(const char *msg = nullptr);
|
||||||
void throwCantUnpack(const char *msg) NORET;
|
NORET void throwAlreadyPackedByUPX(const char *msg = nullptr);
|
||||||
void throwNotPacked(const char *msg = NULL) NORET;
|
NORET void throwCantUnpack(const char *msg);
|
||||||
void throwFilterException() NORET;
|
NORET void throwNotPacked(const char *msg = nullptr);
|
||||||
void throwBadLoader() NORET;
|
NORET void throwFilterException();
|
||||||
void throwChecksumError() NORET;
|
NORET void throwBadLoader();
|
||||||
void throwCompressedDataViolation() NORET;
|
NORET void throwChecksumError();
|
||||||
void throwInternalError(const char *msg) NORET;
|
NORET void throwCompressedDataViolation();
|
||||||
void throwIOException(const char *msg = NULL, int e = 0) NORET;
|
NORET void throwInternalError(const char *msg);
|
||||||
void throwEOFException(const char *msg = NULL, int e = 0) NORET;
|
NORET void throwOutOfMemoryException(const char *msg = nullptr);
|
||||||
|
NORET void throwIOException(const char *msg = nullptr, int e = 0);
|
||||||
|
NORET void throwEOFException(const char *msg = nullptr, int e = 0);
|
||||||
|
|
||||||
#undef NORET
|
#undef NORET
|
||||||
|
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+182
-227
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,62 +22,51 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "mem.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
// static functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void File::chmod(const char *name, int mode)
|
void FileBase::chmod(const char *name, int mode) {
|
||||||
{
|
#if (HAVE_CHMOD)
|
||||||
#if defined(HAVE_CHMOD)
|
if (::chmod(name, mode) != 0)
|
||||||
if (::chmod(name,mode) != 0)
|
throwIOException(name, errno);
|
||||||
throwIOException(name,errno);
|
|
||||||
#else
|
#else
|
||||||
UNUSED(name); UNUSED(mode);
|
UNUSED(name);
|
||||||
|
UNUSED(mode);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBase::rename(const char *old_, const char *new_) {
|
||||||
void File::rename(const char *old_, const char *new_)
|
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
{
|
if (::_rename(old_, new_) != 0)
|
||||||
#if defined(__DJGPP__)
|
|
||||||
if (::_rename(old_,new_) != 0)
|
|
||||||
#else
|
#else
|
||||||
if (::rename(old_,new_) != 0)
|
if (::rename(old_, new_) != 0)
|
||||||
#endif
|
#endif
|
||||||
throwIOException("rename error",errno);
|
throwIOException("rename error", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBase::unlink(const char *name) {
|
||||||
void File::unlink(const char *name)
|
|
||||||
{
|
|
||||||
if (::unlink(name) != 0)
|
if (::unlink(name) != 0)
|
||||||
throwIOException(name,errno);
|
throwIOException(name, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
FileBase::FileBase() :
|
FileBase::FileBase()
|
||||||
_fd(-1), _flags(0), _shflags(0), _mode(0), _name(NULL)
|
: _fd(-1), _flags(0), _shflags(0), _mode(0), _name(nullptr), _offset(0), _length(0) {
|
||||||
{
|
memset(&st, 0, sizeof(st));
|
||||||
memset(&st,0,sizeof(st));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileBase::~FileBase() {
|
||||||
FileBase::~FileBase()
|
#if 0 && defined(__GNUC__) // debug
|
||||||
{
|
|
||||||
#if 0 && defined(__GNUC__) // debug
|
|
||||||
if (isOpen())
|
if (isOpen())
|
||||||
fprintf(stderr,"%s: %s\n", _name, __PRETTY_FUNCTION__);
|
fprintf(stderr,"%s: %s\n", _name, __PRETTY_FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
@@ -87,28 +76,29 @@ FileBase::~FileBase()
|
|||||||
closex();
|
closex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileBase::do_sopen() {
|
||||||
void FileBase::sopen()
|
|
||||||
{
|
|
||||||
if (_shflags < 0)
|
if (_shflags < 0)
|
||||||
_fd = ::open(_name, _flags, _mode);
|
_fd = ::open(_name, _flags, _mode);
|
||||||
else
|
else {
|
||||||
{
|
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
#if defined(__DJGPP__)
|
_fd = ::open(_name, _flags | _shflags, _mode);
|
||||||
_fd = ::open(_name,_flags | _shflags, _mode);
|
|
||||||
#elif defined(__MINT__)
|
#elif defined(__MINT__)
|
||||||
_fd = ::open(_name,_flags | (_shflags & O_SHMODE), _mode);
|
_fd = ::open(_name, _flags | (_shflags & O_SHMODE), _mode);
|
||||||
#elif defined(SH_DENYRW)
|
#elif defined(SH_DENYRW)
|
||||||
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
||||||
#else
|
#else
|
||||||
assert(0);
|
throwInternalError("bad usage of do_sopen()");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (_fd < 0)
|
||||||
|
return false;
|
||||||
|
if (::fstat(_fd, &st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
|
_length = st.st_size;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FileBase::close() {
|
||||||
bool FileBase::close()
|
|
||||||
{
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if (isOpen() && _fd != STDIN_FILENO && _fd != STDOUT_FILENO && _fd != STDERR_FILENO)
|
if (isOpen() && _fd != STDIN_FILENO && _fd != STDOUT_FILENO && _fd != STDERR_FILENO)
|
||||||
if (::close(_fd) == -1)
|
if (::close(_fd) == -1)
|
||||||
@@ -116,98 +106,68 @@ bool FileBase::close()
|
|||||||
_fd = -1;
|
_fd = -1;
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_mode = 0;
|
_mode = 0;
|
||||||
_name = NULL;
|
_name = nullptr;
|
||||||
|
_offset = 0;
|
||||||
|
_length = 0;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBase::closex() {
|
||||||
void FileBase::closex()
|
|
||||||
{
|
|
||||||
if (!close())
|
if (!close())
|
||||||
throwIOException("close failed",errno);
|
throwIOException("close failed", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t FileBase::seek(upx_off_t off, int whence) {
|
||||||
int FileBase::read(void *buf, int len)
|
|
||||||
{
|
|
||||||
if (!isOpen() || len < 0)
|
|
||||||
throwIOException("bad read");
|
|
||||||
errno = 0;
|
|
||||||
long l = acc_safe_hread(_fd, buf, len);
|
|
||||||
if (errno)
|
|
||||||
throwIOException("read error",errno);
|
|
||||||
return (int) l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int FileBase::readx(void *buf, int len)
|
|
||||||
{
|
|
||||||
int l = this->read(buf, len);
|
|
||||||
if (l != len)
|
|
||||||
throwEOFException();
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileBase::write(const void *buf, int len)
|
|
||||||
{
|
|
||||||
if (!isOpen() || len < 0)
|
|
||||||
throwIOException("bad write");
|
|
||||||
errno = 0;
|
|
||||||
long l = acc_safe_hwrite(_fd, buf, len);
|
|
||||||
if (l != len)
|
|
||||||
throwIOException("write error",errno);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FileBase::seek(off_t off, int whence)
|
|
||||||
{
|
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throwIOException("bad seek 1");
|
throwIOException("bad seek 1");
|
||||||
if (whence == SEEK_SET && off < 0)
|
mem_size_assert(1, off >= 0 ? off : -off); // sanity check
|
||||||
throwIOException("bad seek 2");
|
if (whence == SEEK_SET) {
|
||||||
if (whence == SEEK_END && off > 0)
|
if (off < 0)
|
||||||
throwIOException("bad seek 3");
|
throwIOException("bad seek 2");
|
||||||
if (::lseek(_fd,off,whence) < 0)
|
off += _offset;
|
||||||
throwIOException("seek error",errno);
|
}
|
||||||
|
if (whence == SEEK_END) {
|
||||||
|
if (off > 0)
|
||||||
|
throwIOException("bad seek 3");
|
||||||
|
off += _offset + _length;
|
||||||
|
whence = SEEK_SET;
|
||||||
|
}
|
||||||
|
if (::lseek(_fd, off, whence) < 0)
|
||||||
|
throwIOException("seek error", errno);
|
||||||
|
return off - _offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t FileBase::tell() const {
|
||||||
off_t FileBase::tell() const
|
|
||||||
{
|
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throwIOException("bad tell");
|
throwIOException("bad tell");
|
||||||
off_t l = ::lseek(_fd, 0, SEEK_CUR);
|
upx_off_t l = ::lseek(_fd, 0, SEEK_CUR);
|
||||||
if (l < 0)
|
if (l < 0)
|
||||||
throwIOException("tell error",errno);
|
throwIOException("tell error", errno);
|
||||||
return l;
|
return l - _offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileBase::set_extent(upx_off_t offset, upx_off_t length) {
|
||||||
|
_offset = offset;
|
||||||
|
_length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
upx_off_t FileBase::st_size() const { return _length; }
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
InputFile::InputFile()
|
InputFile::InputFile() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void InputFile::sopen(const char *name, int flags, int shflags) {
|
||||||
InputFile::~InputFile()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InputFile::sopen(const char *name, int flags, int shflags)
|
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
_name = name;
|
_name = name;
|
||||||
_flags = flags;
|
_flags = flags;
|
||||||
_shflags = shflags;
|
_shflags = shflags;
|
||||||
_mode = 0;
|
_mode = 0;
|
||||||
FileBase::sopen();
|
_offset = 0;
|
||||||
if (!isOpen())
|
_length = 0;
|
||||||
{
|
if (!super::do_sopen()) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
throw FileNotFoundException(_name, errno);
|
throw FileNotFoundException(_name, errno);
|
||||||
else if (errno == EEXIST)
|
else if (errno == EEXIST)
|
||||||
@@ -215,83 +175,51 @@ void InputFile::sopen(const char *name, int flags, int shflags)
|
|||||||
else
|
else
|
||||||
throwIOException(_name, errno);
|
throwIOException(_name, errno);
|
||||||
}
|
}
|
||||||
|
_length_orig = _length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InputFile::read(SPAN_P(void) buf, int len) {
|
||||||
int InputFile::read(void *buf, int len)
|
if (!isOpen() || len < 0)
|
||||||
{
|
throwIOException("bad read");
|
||||||
return super::read(buf, len);
|
mem_size_assert(1, len); // sanity check
|
||||||
|
errno = 0;
|
||||||
|
long l = acc_safe_hread(_fd, raw_bytes(buf, len), len);
|
||||||
|
if (errno)
|
||||||
|
throwIOException("read error", errno);
|
||||||
|
return (int) l;
|
||||||
}
|
}
|
||||||
|
|
||||||
int InputFile::readx(void *buf, int len)
|
int InputFile::readx(SPAN_P(void) buf, int len) {
|
||||||
{
|
int l = this->read(buf, len);
|
||||||
return super::readx(buf, len);
|
if (l != len)
|
||||||
|
throwEOFException();
|
||||||
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t InputFile::seek(upx_off_t off, int whence) {
|
||||||
int InputFile::read(MemBuffer *buf, int len)
|
upx_off_t pos = super::seek(off, whence);
|
||||||
{
|
if (_length < pos)
|
||||||
buf->checkState();
|
throwIOException("bad seek 4");
|
||||||
assert((unsigned)len <= buf->getSize());
|
return pos;
|
||||||
return read(buf->getVoidPtr(), len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int InputFile::readx(MemBuffer *buf, int len)
|
|
||||||
{
|
|
||||||
buf->checkState();
|
|
||||||
assert((unsigned)len <= buf->getSize());
|
|
||||||
return read(buf->getVoidPtr(), len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int InputFile::read(MemBuffer &buf, int len)
|
|
||||||
{
|
|
||||||
return read(&buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
int InputFile::readx(MemBuffer &buf, int len)
|
|
||||||
{
|
|
||||||
return readx(&buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void InputFile::seek(off_t off, int whence)
|
|
||||||
{
|
|
||||||
super::seek(off,whence);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
off_t InputFile::tell() const
|
|
||||||
{
|
|
||||||
return super::tell();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t InputFile::st_size_orig() const { return _length_orig; }
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
OutputFile::OutputFile() :
|
OutputFile::OutputFile() : bytes_written(0) {}
|
||||||
bytes_written(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void OutputFile::sopen(const char *name, int flags, int shflags, int mode) {
|
||||||
OutputFile::~OutputFile()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OutputFile::sopen(const char *name, int flags, int shflags, int mode)
|
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
_name = name;
|
_name = name;
|
||||||
_flags = flags;
|
_flags = flags;
|
||||||
_shflags = shflags;
|
_shflags = shflags;
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
FileBase::sopen();
|
_offset = 0;
|
||||||
if (!isOpen())
|
_length = 0;
|
||||||
{
|
if (!super::do_sopen()) {
|
||||||
#if 0
|
#if 0
|
||||||
// don't throw FileNotFound here -- this is confusing
|
// don't throw FileNotFound here -- this is confusing
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
@@ -299,15 +227,13 @@ void OutputFile::sopen(const char *name, int flags, int shflags, int mode)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (errno == EEXIST)
|
if (errno == EEXIST)
|
||||||
throw FileAlreadyExistsException(_name,errno);
|
throw FileAlreadyExistsException(_name, errno);
|
||||||
else
|
else
|
||||||
throwIOException(_name,errno);
|
throwIOException(_name, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OutputFile::openStdout(int flags, bool force) {
|
||||||
bool OutputFile::openStdout(int flags, bool force)
|
|
||||||
{
|
|
||||||
close();
|
close();
|
||||||
int fd = STDOUT_FILENO;
|
int fd = STDOUT_FILENO;
|
||||||
if (!force && acc_isatty(fd))
|
if (!force && acc_isatty(fd))
|
||||||
@@ -316,76 +242,105 @@ bool OutputFile::openStdout(int flags, bool force)
|
|||||||
_flags = flags;
|
_flags = flags;
|
||||||
_shflags = -1;
|
_shflags = -1;
|
||||||
_mode = 0;
|
_mode = 0;
|
||||||
|
_offset = 0;
|
||||||
|
_length = 0;
|
||||||
if (flags && acc_set_binmode(fd, 1) == -1)
|
if (flags && acc_set_binmode(fd, 1) == -1)
|
||||||
throwIOException(_name, errno);
|
throwIOException(_name, errno);
|
||||||
_fd = fd;
|
_fd = fd;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputFile::write(SPAN_0(const void) buf, int len) {
|
||||||
void OutputFile::write(const void *buf, int len)
|
if (!isOpen() || len < 0)
|
||||||
{
|
throwIOException("bad write");
|
||||||
super::write(buf, len);
|
// allow nullptr if len == 0
|
||||||
|
if (len == 0)
|
||||||
|
return;
|
||||||
|
mem_size_assert(1, len); // sanity check
|
||||||
|
errno = 0;
|
||||||
|
#if 0
|
||||||
|
fprintf(stderr, "write %p %zd (%p) %d\n", buf.raw_ptr(), buf.raw_size_in_bytes(),
|
||||||
|
buf.raw_base(), len);
|
||||||
|
#endif
|
||||||
|
long l = acc_safe_hwrite(_fd, raw_bytes(buf, len), len);
|
||||||
|
if (l != len)
|
||||||
|
throwIOException("write error", errno);
|
||||||
bytes_written += len;
|
bytes_written += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t OutputFile::st_size() const {
|
||||||
void OutputFile::write(const MemBuffer *buf, int len)
|
if (opt->to_stdout) { // might be a pipe ==> .st_size is invalid
|
||||||
{
|
return bytes_written; // too big if seek()+write() instead of rewrite()
|
||||||
buf->checkState();
|
}
|
||||||
assert((unsigned)len <= buf->getSize());
|
struct stat my_st;
|
||||||
write(buf->getVoidPtr(), len);
|
my_st.st_size = 0;
|
||||||
|
if (::fstat(_fd, &my_st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
|
return my_st.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutputFile::rewrite(SPAN_P(const void) buf, int len) {
|
||||||
void OutputFile::write(const MemBuffer &buf, int len)
|
assert(!opt->to_stdout);
|
||||||
{
|
write(buf, len);
|
||||||
write(&buf, len);
|
bytes_written -= len; // restore
|
||||||
}
|
}
|
||||||
|
|
||||||
|
upx_off_t OutputFile::seek(upx_off_t off, int whence) {
|
||||||
|
mem_size_assert(1, off >= 0 ? off : -off); // sanity check
|
||||||
|
assert(!opt->to_stdout);
|
||||||
|
switch (whence) {
|
||||||
|
case SEEK_SET: {
|
||||||
|
if (bytes_written < off) {
|
||||||
|
bytes_written = off;
|
||||||
|
}
|
||||||
|
_length = bytes_written; // cheap, lazy update; needed?
|
||||||
|
} break;
|
||||||
|
case SEEK_END: {
|
||||||
|
_length = bytes_written; // necessary
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
return super::seek(off, whence);
|
||||||
|
}
|
||||||
|
|
||||||
void OutputFile::dump(const char *name, const void *buf, int len, int flags)
|
// WARNING: fsync() does not exist in some Windows environments.
|
||||||
{
|
// This trick works only on UNIX-like systems.
|
||||||
|
// int OutputFile::read(void *buf, int len)
|
||||||
|
//{
|
||||||
|
// fsync(_fd);
|
||||||
|
// InputFile infile;
|
||||||
|
// infile.open(this->getName(), O_RDONLY | O_BINARY);
|
||||||
|
// infile.seek(this->tell(), SEEK_SET);
|
||||||
|
// return infile.read(buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
|
void OutputFile::set_extent(upx_off_t offset, upx_off_t length) {
|
||||||
|
super::set_extent(offset, length);
|
||||||
|
bytes_written = 0;
|
||||||
|
if (0 == offset && (upx_off_t) ~0u == length) {
|
||||||
|
if (::fstat(_fd, &st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
|
_length = st.st_size - offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
upx_off_t OutputFile::unset_extent() {
|
||||||
|
upx_off_t l = ::lseek(_fd, 0, SEEK_END);
|
||||||
|
if (l < 0)
|
||||||
|
throwIOException("lseek error", errno);
|
||||||
|
_offset = 0;
|
||||||
|
_length = l;
|
||||||
|
bytes_written = _length;
|
||||||
|
return _length;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OutputFile::dump(const char *name, SPAN_P(const void) buf, int len, int flags) {
|
||||||
if (flags < 0)
|
if (flags < 0)
|
||||||
flags = O_CREAT | O_BINARY | O_TRUNC;
|
flags = O_CREAT | O_TRUNC;
|
||||||
flags |= O_WRONLY;
|
flags |= O_WRONLY | O_BINARY;
|
||||||
OutputFile f;
|
OutputFile f;
|
||||||
f.open(name, flags, 0600);
|
f.open(name, flags, 0600);
|
||||||
f.write(buf, len);
|
f.write(raw_bytes(buf, len), len);
|
||||||
f.closex();
|
f.closex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
MemoryOutputFile::MemoryOutputFile() :
|
|
||||||
b(NULL), b_size(0), b_pos(0), bytes_written(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MemoryOutputFile::write(const void *buf, int len)
|
|
||||||
{
|
|
||||||
if (!isOpen() || len < 0)
|
|
||||||
throwIOException("bad write");
|
|
||||||
if (len == 0)
|
|
||||||
return;
|
|
||||||
if (b_pos + len > b_size)
|
|
||||||
throwIOException("write error",ENOSPC);
|
|
||||||
memcpy(b + b_pos, buf, len);
|
|
||||||
b_pos += len;
|
|
||||||
bytes_written += len;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* if 0 */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+64
-121
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,170 +22,113 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
#ifndef __UPX_FILE_H
|
#ifndef UPX_FILE_H__
|
||||||
#define __UPX_FILE_H
|
#define UPX_FILE_H__ 1
|
||||||
|
|
||||||
class MemBuffer;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class File
|
class FileBase {
|
||||||
{
|
|
||||||
protected:
|
|
||||||
File() { }
|
|
||||||
virtual ~File() { }
|
|
||||||
public:
|
|
||||||
static void chmod(const char *name, int mode);
|
|
||||||
static void rename(const char *old_, const char *new_);
|
|
||||||
static void unlink(const char *name);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class FileBase : public File
|
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
FileBase();
|
FileBase();
|
||||||
virtual ~FileBase();
|
virtual ~FileBase();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool close();
|
bool close();
|
||||||
virtual void closex();
|
void closex();
|
||||||
virtual bool isOpen() const { return _fd >= 0; }
|
bool isOpen() const { return _fd >= 0; }
|
||||||
int getFd() const { return _fd; }
|
int getFd() const { return _fd; }
|
||||||
const char *getName() const { return _name; }
|
const char *getName() const { return _name; }
|
||||||
|
|
||||||
protected:
|
virtual upx_off_t seek(upx_off_t off, int whence);
|
||||||
void sopen();
|
upx_off_t tell() const;
|
||||||
virtual int read(void *buf, int len);
|
virtual upx_off_t st_size() const; // { return _length; }
|
||||||
virtual int readx(void *buf, int len);
|
virtual void set_extent(upx_off_t offset, upx_off_t length);
|
||||||
virtual void write(const void *buf, int len);
|
|
||||||
virtual void seek(off_t off, int whence);
|
|
||||||
virtual off_t tell() const;
|
|
||||||
|
|
||||||
int _fd;
|
|
||||||
int _flags;
|
|
||||||
int _shflags;
|
|
||||||
int _mode;
|
|
||||||
const char *_name;
|
|
||||||
public:
|
public:
|
||||||
struct stat st;
|
// static file-related util functions
|
||||||
};
|
static void chmod(const char *name, int mode);
|
||||||
|
static void rename(const char *old_, const char *new_);
|
||||||
|
static void unlink(const char *name);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool do_sopen();
|
||||||
|
int _fd = -1;
|
||||||
|
int _flags = 0;
|
||||||
|
int _shflags = 0;
|
||||||
|
int _mode = 0;
|
||||||
|
const char *_name = nullptr;
|
||||||
|
upx_off_t _offset = 0;
|
||||||
|
upx_off_t _length = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
struct stat st = {};
|
||||||
|
};
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class InputFile : public FileBase
|
class InputFile final : public FileBase {
|
||||||
{
|
|
||||||
typedef FileBase super;
|
typedef FileBase super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputFile();
|
InputFile();
|
||||||
virtual ~InputFile();
|
virtual ~InputFile() {}
|
||||||
|
|
||||||
virtual void sopen(const char *name, int flags, int shflags);
|
void sopen(const char *name, int flags, int shflags);
|
||||||
virtual void open(const char *name, int flags)
|
void open(const char *name, int flags) { sopen(name, flags, -1); }
|
||||||
{
|
|
||||||
sopen(name, flags, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual int read(void *buf, int len);
|
int read(SPAN_P(void) buf, int len);
|
||||||
virtual int readx(void *buf, int len);
|
int readx(SPAN_P(void) buf, int len);
|
||||||
virtual int read(MemBuffer *buf, int len);
|
|
||||||
virtual int readx(MemBuffer *buf, int len);
|
|
||||||
virtual int read(MemBuffer &buf, int len);
|
|
||||||
virtual int readx(MemBuffer &buf, int len);
|
|
||||||
|
|
||||||
virtual void seek(off_t off, int whence);
|
virtual upx_off_t seek(upx_off_t off, int whence) override;
|
||||||
virtual off_t tell() const;
|
upx_off_t st_size_orig() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
upx_off_t _length_orig = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class OutputFile : public FileBase
|
class OutputFile final : public FileBase {
|
||||||
{
|
|
||||||
typedef FileBase super;
|
typedef FileBase super;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutputFile();
|
OutputFile();
|
||||||
virtual ~OutputFile();
|
virtual ~OutputFile() {}
|
||||||
|
|
||||||
virtual void sopen(const char *name, int flags, int shflags, int mode);
|
void sopen(const char *name, int flags, int shflags, int mode);
|
||||||
virtual void open(const char *name, int flags, int mode)
|
void open(const char *name, int flags, int mode) { sopen(name, flags, -1, mode); }
|
||||||
{
|
bool openStdout(int flags = 0, bool force = false);
|
||||||
sopen(name, flags, -1, mode);
|
|
||||||
}
|
|
||||||
virtual bool openStdout(int flags=0, bool force=false);
|
|
||||||
|
|
||||||
virtual void write(const void *buf, int len);
|
// info: allow nullptr if len == 0
|
||||||
virtual void write(const MemBuffer *buf, int len);
|
void write(SPAN_0(const void) buf, int len);
|
||||||
virtual void write(const MemBuffer &buf, int len);
|
|
||||||
|
|
||||||
off_t getBytesWritten() const { return bytes_written; }
|
virtual upx_off_t seek(upx_off_t off, int whence) override;
|
||||||
|
virtual upx_off_t st_size() const override; // { return _length; }
|
||||||
|
virtual void set_extent(upx_off_t offset, upx_off_t length) override;
|
||||||
|
upx_off_t unset_extent(); // returns actual length
|
||||||
|
|
||||||
// FIXME - these won't work when using the `--stdout' option
|
upx_off_t getBytesWritten() const { return bytes_written; }
|
||||||
virtual void seek(off_t off, int whence)
|
|
||||||
{
|
// FIXME - these won't work when using the '--stdout' option
|
||||||
assert(!opt->to_stdout);
|
void rewrite(SPAN_P(const void) buf, int len);
|
||||||
super::seek(off,whence);
|
|
||||||
}
|
|
||||||
virtual void rewrite(const void *buf, int len)
|
|
||||||
{
|
|
||||||
assert(!opt->to_stdout);
|
|
||||||
write(buf, len);
|
|
||||||
bytes_written -= len; // restore
|
|
||||||
}
|
|
||||||
|
|
||||||
// util
|
// util
|
||||||
static void dump(const char *name, const void *buf, int len, int flags=-1);
|
static void dump(const char *name, SPAN_P(const void) buf, int len, int flags = -1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
off_t bytes_written;
|
upx_off_t bytes_written = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/*************************************************************************
|
/* vim:set ts=4 sw=4 et: */
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#if 0 /* NOT USED */
|
|
||||||
class MemoryOutputFile : public FileBase
|
|
||||||
{
|
|
||||||
typedef FileBase super;
|
|
||||||
public:
|
|
||||||
MemoryOutputFile();
|
|
||||||
virtual ~MemoryOutputFile() { b = NULL; }
|
|
||||||
|
|
||||||
virtual bool close() { b = NULL; return true; }
|
|
||||||
virtual bool isOpen() const { return b != NULL; }
|
|
||||||
virtual void open(void *buf, unsigned size)
|
|
||||||
{ b = (upx_bytep) buf; b_size = size; }
|
|
||||||
|
|
||||||
virtual void write(const void *buf, int len);
|
|
||||||
|
|
||||||
off_t getBytesWritten() const { return bytes_written; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
upx_bytep b;
|
|
||||||
unsigned b_size;
|
|
||||||
unsigned b_pos;
|
|
||||||
off_t bytes_written;
|
|
||||||
};
|
|
||||||
#endif /* if 0 */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* already included */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+30
-20
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -61,19 +61,19 @@ const FilterImp::FilterEntry *FilterImp::getFilter(int id)
|
|||||||
memset(filter_map, 0xff, sizeof(filter_map));
|
memset(filter_map, 0xff, sizeof(filter_map));
|
||||||
for (int i = 0; i < n_filters; i++)
|
for (int i = 0; i < n_filters; i++)
|
||||||
{
|
{
|
||||||
int fid = filters[i].id;
|
int filter_id = filters[i].id;
|
||||||
assert(fid >= 0 && fid <= 255);
|
assert(filter_id >= 0 && filter_id <= 255);
|
||||||
assert(filter_map[fid] == 0xff);
|
assert(filter_map[filter_id] == 0xff);
|
||||||
filter_map[fid] = (unsigned char) i;
|
filter_map[filter_id] = (unsigned char) i;
|
||||||
}
|
}
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id < 0 || id > 255)
|
if (id < 0 || id > 255)
|
||||||
return NULL;
|
return nullptr;
|
||||||
unsigned index = filter_map[id];
|
unsigned index = filter_map[id];
|
||||||
if (index == 0xff) // empty slot
|
if (index == 0xff) // empty slot
|
||||||
return NULL;
|
return nullptr;
|
||||||
assert(filters[index].id == id);
|
assert(filters[index].id == id);
|
||||||
return &filters[index];
|
return &filters[index];
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,21 @@ const FilterImp::FilterEntry *FilterImp::getFilter(int id)
|
|||||||
bool Filter::isValidFilter(int filter_id)
|
bool Filter::isValidFilter(int filter_id)
|
||||||
{
|
{
|
||||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(filter_id);
|
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(filter_id);
|
||||||
return fe != NULL;
|
return fe != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Filter::isValidFilter(int filter_id, const int *allowed_filters)
|
||||||
|
{
|
||||||
|
if (!isValidFilter(filter_id))
|
||||||
|
return false;
|
||||||
|
if (filter_id == 0)
|
||||||
|
return true;
|
||||||
|
if (allowed_filters == nullptr)
|
||||||
|
return false;
|
||||||
|
while (*allowed_filters != FT_END)
|
||||||
|
if (*allowed_filters++ == filter_id)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -93,10 +107,10 @@ bool Filter::isValidFilter(int filter_id)
|
|||||||
void Filter::init(int id_, unsigned addvalue_)
|
void Filter::init(int id_, unsigned addvalue_)
|
||||||
{
|
{
|
||||||
this->id = id_;
|
this->id = id_;
|
||||||
initFilter(this, NULL, 0);
|
initFilter(this, nullptr, 0);
|
||||||
// clear input parameters
|
// clear input parameters
|
||||||
this->addvalue = addvalue_;
|
this->addvalue = addvalue_;
|
||||||
this->preferred_ctos = NULL;
|
this->preferred_ctos = nullptr;
|
||||||
// clear input/output parameters
|
// clear input/output parameters
|
||||||
this->cto = 0;
|
this->cto = 0;
|
||||||
this->n_mru = 0;
|
this->n_mru = 0;
|
||||||
@@ -108,7 +122,7 @@ bool Filter::filter(upx_byte *buf_, unsigned buf_len_)
|
|||||||
initFilter(this, buf_, buf_len_);
|
initFilter(this, buf_, buf_len_);
|
||||||
|
|
||||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||||
if (fe == NULL)
|
if (fe == nullptr)
|
||||||
throwInternalError("filter-1");
|
throwInternalError("filter-1");
|
||||||
if (fe->id == 0)
|
if (fe->id == 0)
|
||||||
return true;
|
return true;
|
||||||
@@ -141,7 +155,7 @@ void Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
|||||||
initFilter(this, buf_, buf_len_);
|
initFilter(this, buf_, buf_len_);
|
||||||
|
|
||||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||||
if (fe == NULL)
|
if (fe == nullptr)
|
||||||
throwInternalError("unfilter-1");
|
throwInternalError("unfilter-1");
|
||||||
if (fe->id == 0)
|
if (fe->id == 0)
|
||||||
return;
|
return;
|
||||||
@@ -193,7 +207,7 @@ bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
|
|||||||
initFilter(this, b, buf_len_);
|
initFilter(this, b, buf_len_);
|
||||||
|
|
||||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||||
if (fe == NULL)
|
if (fe == nullptr)
|
||||||
throwInternalError("scan-1");
|
throwInternalError("scan-1");
|
||||||
if (fe->id == 0)
|
if (fe->id == 0)
|
||||||
return true;
|
return true;
|
||||||
@@ -214,8 +228,4 @@ bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+10
-13
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -21,13 +21,13 @@
|
|||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@cdata.tvnet.hu
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_FILTER_H
|
#ifndef __UPX_FILTER_H
|
||||||
#define __UPX_FILTER_H
|
#define __UPX_FILTER_H 1
|
||||||
|
|
||||||
class Filter;
|
class Filter;
|
||||||
class FilterImp;
|
class FilterImp;
|
||||||
@@ -62,12 +62,13 @@ public:
|
|||||||
bool scan(const upx_byte *buf, unsigned buf_len);
|
bool scan(const upx_byte *buf, unsigned buf_len);
|
||||||
|
|
||||||
static bool isValidFilter(int filter_id);
|
static bool isValidFilter(int filter_id);
|
||||||
|
static bool isValidFilter(int filter_id, const int *allowed_filters);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Will be set by each call to filter()/unfilter().
|
// Will be set by each call to filter()/unfilter().
|
||||||
// Read-only afterwards.
|
// Read-only afterwards.
|
||||||
upx_byte *buf;
|
upx_byte *buf = nullptr;
|
||||||
unsigned buf_len;
|
unsigned buf_len = 0;
|
||||||
|
|
||||||
// Checksum of the buffer before applying the filter
|
// Checksum of the buffer before applying the filter
|
||||||
// or after un-applying the filter.
|
// or after un-applying the filter.
|
||||||
@@ -75,7 +76,7 @@ public:
|
|||||||
|
|
||||||
// Input parameters used by various filters.
|
// Input parameters used by various filters.
|
||||||
unsigned addvalue;
|
unsigned addvalue;
|
||||||
const int *preferred_ctos;
|
const int *preferred_ctos = nullptr;
|
||||||
|
|
||||||
// Input/output parameters used by various filters
|
// Input/output parameters used by various filters
|
||||||
unsigned char cto; // call trick offset
|
unsigned char cto; // call trick offset
|
||||||
@@ -130,8 +131,4 @@ private:
|
|||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+85
-12
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ static int s_ct32_e8e9_bswap_be(Filter *f)
|
|||||||
// 24-bit ARM calltrick ("naive")
|
// 24-bit ARM calltrick ("naive")
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#define CT24ARM(f, cond, addvalue, get, set) \
|
#define CT24ARM_LE(f, cond, addvalue, get, set) \
|
||||||
upx_byte *b = f->buf; \
|
upx_byte *b = f->buf; \
|
||||||
upx_byte *b_end = b + f->buf_len - 4; \
|
upx_byte *b_end = b + f->buf_len - 4; \
|
||||||
do { \
|
do { \
|
||||||
@@ -404,27 +404,100 @@ static int s_ct32_e8e9_bswap_be(Filter *f)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
#define ARMCT_COND (((b[3] & 0x0f) == 0x0b))
|
#define ARMCT_COND_le (((b[3] & 0x0f) == 0x0b))
|
||||||
|
|
||||||
static int f_ct24arm_le(Filter *f)
|
static int f_ct24arm_le(Filter *f)
|
||||||
{
|
{
|
||||||
CT24ARM(f, ARMCT_COND, a / 4 + f->addvalue, get_le24, set_le24)
|
CT24ARM_LE(f, ARMCT_COND_le, a / 4 + f->addvalue, get_le24, set_le24)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int u_ct24arm_le(Filter *f)
|
static int u_ct24arm_le(Filter *f)
|
||||||
{
|
{
|
||||||
CT24ARM(f, ARMCT_COND, 0 - a / 4 - f->addvalue, get_le24, set_le24)
|
CT24ARM_LE(f, ARMCT_COND_le, 0 - a / 4 - f->addvalue, get_le24, set_le24)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s_ct24arm_le(Filter *f)
|
static int s_ct24arm_le(Filter *f)
|
||||||
{
|
{
|
||||||
CT24ARM(f, ARMCT_COND, a + f->addvalue, get_le24, set_dummy)
|
CT24ARM_LE(f, ARMCT_COND_le, a + f->addvalue, get_le24, set_dummy)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CT24ARM
|
#undef CT24ARM_LE
|
||||||
|
|
||||||
|
#define CT24ARM_BE(f, cond, addvalue, get, set) \
|
||||||
|
upx_byte *b = f->buf; \
|
||||||
|
upx_byte *b_end = b + f->buf_len - 4; \
|
||||||
|
do { \
|
||||||
|
if (cond) \
|
||||||
|
{ \
|
||||||
|
unsigned a = (unsigned) (b - f->buf); \
|
||||||
|
f->lastcall = a; \
|
||||||
|
set(1+b, get(1+b) + (addvalue)); \
|
||||||
|
f->calls++; \
|
||||||
|
} \
|
||||||
|
b += 4; \
|
||||||
|
} while (b < b_end); \
|
||||||
|
if (f->lastcall) f->lastcall += 4; \
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#define ARMCT_COND_be (((b[0] & 0x0f) == 0x0b))
|
||||||
|
|
||||||
|
static int f_ct24arm_be(Filter *f)
|
||||||
|
{
|
||||||
|
CT24ARM_BE(f, ARMCT_COND_be, a / 4 + f->addvalue, get_be24, set_be24)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int u_ct24arm_be(Filter *f)
|
||||||
|
{
|
||||||
|
CT24ARM_BE(f, ARMCT_COND_be, 0 - a / 4 - f->addvalue, get_be24, set_be24)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int s_ct24arm_be(Filter *f)
|
||||||
|
{
|
||||||
|
CT24ARM_BE(f, ARMCT_COND_be, a + f->addvalue, get_be24, set_dummy)
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef CT24ARM_BE
|
||||||
#undef ARMCT_COND
|
#undef ARMCT_COND
|
||||||
|
|
||||||
/*
|
/*************************************************************************
|
||||||
vi:ts=4:et:nowrap
|
// 26-bit ARM calltrick ("naive")
|
||||||
*/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#define CT26ARM_LE(f, cond, addvalue, get, set) \
|
||||||
|
upx_byte *b = f->buf; \
|
||||||
|
upx_byte *b_end = b + f->buf_len - 4; \
|
||||||
|
do { \
|
||||||
|
if (cond) \
|
||||||
|
{ \
|
||||||
|
unsigned a = (unsigned) (b - f->buf); \
|
||||||
|
f->lastcall = a; \
|
||||||
|
set(b, get(b) + (addvalue)); \
|
||||||
|
f->calls++; \
|
||||||
|
} \
|
||||||
|
b += 4; \
|
||||||
|
} while (b < b_end); \
|
||||||
|
if (f->lastcall) f->lastcall += 4; \
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
#define ARMCT_COND (((b[3] & 0x7C) == 0x14))
|
||||||
|
|
||||||
|
static int f_ct26arm_le(Filter *f)
|
||||||
|
{
|
||||||
|
CT26ARM_LE(f, ARMCT_COND, a / 4 + f->addvalue, get_le26, set_le26)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int u_ct26arm_le(Filter *f)
|
||||||
|
{
|
||||||
|
CT26ARM_LE(f, ARMCT_COND, 0 - a / 4 - f->addvalue, get_le26, set_le26)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int s_ct26arm_le(Filter *f)
|
||||||
|
{
|
||||||
|
CT26ARM_LE(f, ARMCT_COND, a + f->addvalue, get_le26, set_dummy)
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef CT26ARM_LE
|
||||||
|
#undef ARMCT_COND
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|||||||
+18
-14
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 0;
|
unsigned lastnoncall = size, lastcall = 0;
|
||||||
|
|
||||||
// find a 16MB large empty address space
|
// find a 16 MiB large empty address space
|
||||||
{
|
{
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
@@ -58,10 +58,18 @@ static int F(Filter *f)
|
|||||||
// must not conflict with the mark.
|
// must not conflict with the mark.
|
||||||
// Note that unsigned comparison checks both edges of buffer.
|
// Note that unsigned comparison checks both edges of buffer.
|
||||||
for (ic = 0; ic < size - 5; ic++)
|
for (ic = 0; ic < size - 5; ic++)
|
||||||
if (COND(b,ic) && get_le32(b+ic+1)+ic+1 >= size)
|
{
|
||||||
|
if (!COND(b,ic))
|
||||||
|
continue;
|
||||||
|
jc = get_le32(b+ic+1)+ic+1;
|
||||||
|
if (jc < size)
|
||||||
{
|
{
|
||||||
buf[b[ic+1]] |= 1;
|
if (jc + addvalue >= (1u << 24)) // hi 8 bits won't be cto8
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
buf[b[ic+1]] |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (getcto(f, buf) < 0)
|
if (getcto(f, buf) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -79,8 +87,7 @@ static int F(Filter *f)
|
|||||||
// try to detect 'real' calls only
|
// try to detect 'real' calls only
|
||||||
if (jc < size)
|
if (jc < size)
|
||||||
{
|
{
|
||||||
if ((1u<<24)<=(jc+addvalue)) // hi 8 bits won't be cto8
|
assert(jc + addvalue < (1u << 24)); // hi 8 bits won't be cto8
|
||||||
return 1; // fail - buffer not restored
|
|
||||||
#ifdef U
|
#ifdef U
|
||||||
set_be32(b+ic+1,jc+addvalue+cto);
|
set_be32(b+ic+1,jc+addvalue+cto);
|
||||||
#endif
|
#endif
|
||||||
@@ -119,9 +126,10 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
#ifdef TESTING
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
|
UNUSED(noncalls2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,8 +170,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+19
-15
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
Copyright (C) 2000-2004 John F. Reiser
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -51,16 +51,24 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 0;
|
unsigned lastnoncall = size, lastcall = 0;
|
||||||
|
|
||||||
// find a 16MB large empty address space
|
// find a 16 MiB large empty address space
|
||||||
{
|
{
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
|
|
||||||
for (ic = 0; ic < size - 5; ic++)
|
for (ic = 0; ic < size - 5; ic++)
|
||||||
if (COND(b,ic,lastcall) && get_le32(b+ic+1)+ic+1 >= size)
|
{
|
||||||
|
if (!COND(b,ic,lastcall))
|
||||||
|
continue;
|
||||||
|
jc = get_le32(b+ic+1)+ic+1;
|
||||||
|
if (jc < size)
|
||||||
{
|
{
|
||||||
buf[b[ic+1]] |= 1;
|
if (jc + addvalue >= (1u << 24)) // hi 8 bits won't be cto8
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
buf[b[ic+1]] |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (getcto(f, buf) < 0)
|
if (getcto(f, buf) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -78,8 +86,7 @@ static int F(Filter *f)
|
|||||||
// try to detect 'real' calls only
|
// try to detect 'real' calls only
|
||||||
if (jc < size)
|
if (jc < size)
|
||||||
{
|
{
|
||||||
if ((1u<<24)<=(jc+addvalue)) // hi 8 bits won't be cto8
|
assert(jc + addvalue < (1u << 24)); // hi 8 bits won't be cto8
|
||||||
return 1; // fail - buffer not restored
|
|
||||||
#ifdef U
|
#ifdef U
|
||||||
set_be32(b+ic+1,jc+addvalue+cto);
|
set_be32(b+ic+1,jc+addvalue+cto);
|
||||||
#endif
|
#endif
|
||||||
@@ -118,9 +125,10 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
#ifdef TESTING
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
|
UNUSED(noncalls2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,8 +169,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
Copyright (C) 2000-2004 John F. Reiser
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -62,7 +62,7 @@ f80_jcc2(Filter const *f)
|
|||||||
return f80_jmp1(f);
|
return f80_jmp1(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int const N_MRU = 32; // does not have to be a power of 2
|
#define N_MRU 32 // does not have to be a power of 2
|
||||||
|
|
||||||
// Adaptively remember recent destinations.
|
// Adaptively remember recent destinations.
|
||||||
static void
|
static void
|
||||||
@@ -123,8 +123,8 @@ static int F(Filter *f)
|
|||||||
N_MRU : 0;
|
N_MRU : 0;
|
||||||
#endif //}
|
#endif //}
|
||||||
|
|
||||||
// FIXME: We must fit into 8MB because we steal one bit.
|
// FIXME: We must fit into 8 MiB because we steal one bit.
|
||||||
// find a 16MB large empty address space
|
// find a 16 MiB large empty address space
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
@@ -249,11 +249,12 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
/*#ifdef TESTING*/
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",
|
||||||
calls,noncalls,noncalls2,size,cto8);
|
calls,noncalls,noncalls2,size,cto8);
|
||||||
printf("CALL/JMP/JCC %d %d %d\n",wtally[0],wtally[1],wtally[2]);
|
printf("CALL/JMP/JCC %d %d %d\n",wtally[0],wtally[1],wtally[2]);
|
||||||
/*#endif*/
|
#endif
|
||||||
|
UNUSED(noncalls2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,6 +301,9 @@ static int U(Filter *f)
|
|||||||
}
|
}
|
||||||
else { // not 1st time at this destination
|
else { // not 1st time at this destination
|
||||||
jc >>= 1;
|
jc >>= 1;
|
||||||
|
if (N_MRU <= jc) {
|
||||||
|
throwCompressedDataViolation();
|
||||||
|
}
|
||||||
int kh = jc + hand;
|
int kh = jc + hand;
|
||||||
if (N_MRU <= kh) {
|
if (N_MRU <= kh) {
|
||||||
kh -= N_MRU;
|
kh -= N_MRU;
|
||||||
@@ -337,12 +341,8 @@ static int U(Filter *f)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#undef N_MRU
|
||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+19
-15
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
Copyright (C) 2000-2004 John F. Reiser
|
Copyright (C) 2000-2022 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -52,16 +52,24 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 0;
|
unsigned lastnoncall = size, lastcall = 0;
|
||||||
|
|
||||||
// find a 16MB large empty address space
|
// find a 16 MiB large empty address space
|
||||||
{
|
{
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
|
|
||||||
for (ic = 0; ic < size - 5; ic++)
|
for (ic = 0; ic < size - 5; ic++)
|
||||||
if (COND(b,ic,lastcall,id) && get_le32(b+ic+1)+ic+1 >= size)
|
{
|
||||||
|
if (!COND(b,ic,lastcall,id))
|
||||||
|
continue;
|
||||||
|
jc = get_le32(b+ic+1)+ic+1;
|
||||||
|
if (jc < size)
|
||||||
{
|
{
|
||||||
buf[b[ic+1]] |= 1;
|
if (jc + addvalue >= (1u << 24)) // hi 8 bits won't be cto8
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
buf[b[ic+1]] |= 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (getcto(f, buf) < 0)
|
if (getcto(f, buf) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -79,8 +87,7 @@ static int F(Filter *f)
|
|||||||
// try to detect 'real' calls only
|
// try to detect 'real' calls only
|
||||||
if (jc < size)
|
if (jc < size)
|
||||||
{
|
{
|
||||||
if ((1u<<24)<=(jc+addvalue)) // hi 8 bits won't be cto8
|
assert(jc + addvalue < (1u << 24)); // hi 8 bits won't be cto8
|
||||||
return 1; // fail - buffer not restored
|
|
||||||
#ifdef U
|
#ifdef U
|
||||||
set_be32(b+ic+1,jc+addvalue+cto);
|
set_be32(b+ic+1,jc+addvalue+cto);
|
||||||
#endif
|
#endif
|
||||||
@@ -119,9 +126,10 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
#ifdef TESTING
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
|
UNUSED(noncalls2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +172,4 @@ static int U(Filter *f)
|
|||||||
#undef F
|
#undef F
|
||||||
#undef U
|
#undef U
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -166,8 +166,4 @@ static int s_ctsw32_e9_e8(Filter *f)
|
|||||||
|
|
||||||
#undef CTSW32
|
#undef CTSW32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -67,9 +67,4 @@ static int getcto(Filter *f, const unsigned char *buf, const int n=256)
|
|||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+18
-17
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
Copyright (C) 2004-2005 John F. Reiser
|
Copyright (C) 2004-2022 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -47,7 +47,7 @@ static int F(Filter *f)
|
|||||||
// scan
|
// scan
|
||||||
const upx_byte *b = f->buf;
|
const upx_byte *b = f->buf;
|
||||||
#endif
|
#endif
|
||||||
const unsigned size = umin(f->buf_len, -(~0u<<(32 - (6+ W_CTO))));
|
const unsigned size = umin(f->buf_len, 0u - (~0u<<(32 - (6+ W_CTO))));
|
||||||
const unsigned size4 = size -4;
|
const unsigned size4 = size -4;
|
||||||
|
|
||||||
unsigned ic;
|
unsigned ic;
|
||||||
@@ -58,7 +58,7 @@ static int F(Filter *f)
|
|||||||
{
|
{
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
unsigned short wbuf[256];
|
unsigned short wbuf[256];
|
||||||
const size_t WW = (size_t)0 - (~(size_t)0) << W_CTO; // ???
|
const size_t WW = (size_t)0 - ((~(size_t)0) << W_CTO); // ???
|
||||||
memset(wbuf, 0, sizeof(wbuf));
|
memset(wbuf, 0, sizeof(wbuf));
|
||||||
memset(buf , 0, WW);
|
memset(buf , 0, WW);
|
||||||
memset(buf + WW, 1, 256 - WW);
|
memset(buf + WW, 1, 256 - WW);
|
||||||
@@ -72,9 +72,11 @@ static int F(Filter *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (getcto(f, buf) < 0) {
|
if (getcto(f, buf) < 0) {
|
||||||
if (0!=W_CTO) // FIXME: what is this ???
|
#if (W_CTO != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
#else
|
||||||
f->cto = 0;
|
f->cto = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const unsigned char cto8 = f->cto;
|
const unsigned char cto8 = f->cto;
|
||||||
@@ -95,8 +97,9 @@ static int F(Filter *f)
|
|||||||
lastcall = ic;
|
lastcall = ic;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(0==W_CTO // FIXME: what is this ???
|
#if (W_CTO != 0)
|
||||||
|| (~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != cto8); // this should not happen
|
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != (unsigned) cto8); // this should not happen
|
||||||
|
#endif
|
||||||
lastnoncall = ic;
|
lastnoncall = ic;
|
||||||
noncalls++;
|
noncalls++;
|
||||||
}
|
}
|
||||||
@@ -105,8 +108,9 @@ static int F(Filter *f)
|
|||||||
f->calls = calls;
|
f->calls = calls;
|
||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
ACC_UNUSED(lastnoncall);
|
||||||
|
|
||||||
#if 0
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d text_size=%x calltrickoffset=%x\n",
|
printf("\ncalls=%d noncalls=%d text_size=%x calltrickoffset=%x\n",
|
||||||
calls,noncalls,size,cto8);
|
calls,noncalls,size,cto8);
|
||||||
#endif
|
#endif
|
||||||
@@ -122,14 +126,14 @@ static int F(Filter *f)
|
|||||||
static int U(Filter *f)
|
static int U(Filter *f)
|
||||||
{
|
{
|
||||||
upx_byte *b = f->buf;
|
upx_byte *b = f->buf;
|
||||||
const unsigned size4 = umin(f->buf_len - 4, -(~0u<<(32 - (6+ W_CTO))));
|
const unsigned size4 = umin(f->buf_len - 4, 0u - (~0u<<(32 - (6+ W_CTO))));
|
||||||
const unsigned addvalue = f->addvalue;
|
const unsigned addvalue = f->addvalue;
|
||||||
|
|
||||||
unsigned ic;
|
unsigned ic;
|
||||||
|
|
||||||
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
||||||
unsigned const word = get_be32(b+ic);
|
unsigned const word = get_be32(b+ic);
|
||||||
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == f->cto) {
|
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == (unsigned) f->cto) {
|
||||||
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
||||||
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
||||||
f->calls++;
|
f->calls++;
|
||||||
@@ -149,7 +153,4 @@ static int U(Filter *f)
|
|||||||
|
|
||||||
#undef W_CTO
|
#undef W_CTO
|
||||||
|
|
||||||
/*
|
/* vim:set ts=4 sw=4 et: */
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -79,9 +79,4 @@
|
|||||||
assert((int)f->calls > 0); \
|
assert((int)f->calls > 0); \
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub16_4(Filter *f)
|
|||||||
#undef ADD16
|
#undef ADD16
|
||||||
#undef SCAN16
|
#undef SCAN16
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub32_4(Filter *f)
|
|||||||
#undef ADD32
|
#undef ADD32
|
||||||
#undef SCAN32
|
#undef SCAN32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -115,8 +115,4 @@ static int s_sub8_4(Filter *f)
|
|||||||
#undef ADD8
|
#undef ADD8
|
||||||
#undef SCAN8
|
#undef SCAN8
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+4
-9
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -180,9 +180,4 @@ static int s_sw32_e8e9(Filter *f)
|
|||||||
|
|
||||||
#undef SW32
|
#undef SW32
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@cdata.tvnet.hu
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ umin(unsigned const a, unsigned const b)
|
|||||||
|
|
||||||
#define COND1(b,x) (b[x] == 0xe8 || b[x] == 0xe9)
|
#define COND1(b,x) (b[x] == 0xe8 || b[x] == 0xe9)
|
||||||
#define COND2(b,x,lc) (lc!=(x) && 0xf==b[(x)-1] && 0x80<=b[x] && b[x]<=0x8f)
|
#define COND2(b,x,lc) (lc!=(x) && 0xf==b[(x)-1] && 0x80<=b[x] && b[x]<=0x8f)
|
||||||
#define COND(b,x,lc,id) (COND1(b,x) || ((9<=(0xf&(id))) && COND2(b,x,lc)))
|
#define COND(b,x,lc,id) (COND1(b,x) || ((9<=(0xf&(id))) && COND2(b,x,lc)))
|
||||||
#define F f_ctok32_e8e9_bswap_le
|
#define F f_ctok32_e8e9_bswap_le
|
||||||
#define U u_ctok32_e8e9_bswap_le
|
#define U u_ctok32_e8e9_bswap_le
|
||||||
#include "filter/ctok.h"
|
#include "filter/ctok.h"
|
||||||
@@ -170,7 +170,7 @@ umin(unsigned const a, unsigned const b)
|
|||||||
|
|
||||||
const FilterImp::FilterEntry FilterImp::filters[] = {
|
const FilterImp::FilterEntry FilterImp::filters[] = {
|
||||||
// no filter
|
// no filter
|
||||||
{ 0x00, 0, 0, NULL, NULL, NULL },
|
{ 0x00, 0, 0, nullptr, nullptr, nullptr },
|
||||||
|
|
||||||
// 16-bit calltrick
|
// 16-bit calltrick
|
||||||
{ 0x01, 4, 0, f_ct16_e8, u_ct16_e8, s_ct16_e8 },
|
{ 0x01, 4, 0, f_ct16_e8, u_ct16_e8, s_ct16_e8 },
|
||||||
@@ -226,6 +226,10 @@ const FilterImp::FilterEntry FilterImp::filters[] = {
|
|||||||
|
|
||||||
// 24-bit calltrick for arm
|
// 24-bit calltrick for arm
|
||||||
{ 0x50, 8, 0x01ffffff, f_ct24arm_le, u_ct24arm_le, s_ct24arm_le },
|
{ 0x50, 8, 0x01ffffff, f_ct24arm_le, u_ct24arm_le, s_ct24arm_le },
|
||||||
|
{ 0x51, 8, 0x01ffffff, f_ct24arm_be, u_ct24arm_be, s_ct24arm_be },
|
||||||
|
|
||||||
|
// 26-bit calltrick for arm64
|
||||||
|
{ 0x52, 8, 0x03ffffff, f_ct26arm_le, u_ct26arm_le, s_ct26arm_le },
|
||||||
|
|
||||||
// 32-bit cto calltrick with jmp and jcc(swap 0x0f/0x8Y) and relative renumbering
|
// 32-bit cto calltrick with jmp and jcc(swap 0x0f/0x8Y) and relative renumbering
|
||||||
{ 0x80, 8, 0x00ffffff, f_ctojr32_e8e9_bswap_le, u_ctojr32_e8e9_bswap_le, s_ctojr32_e8e9_bswap_le },
|
{ 0x80, 8, 0x00ffffff, f_ctojr32_e8e9_bswap_le, u_ctojr32_e8e9_bswap_le, s_ctojr32_e8e9_bswap_le },
|
||||||
@@ -259,8 +263,4 @@ const FilterImp::FilterEntry FilterImp::filters[] = {
|
|||||||
|
|
||||||
const int FilterImp::n_filters = TABLESIZE(filters);
|
const int FilterImp::n_filters = TABLESIZE(filters);
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+192
-128
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2006 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,11 +22,14 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "compress.h"
|
||||||
|
#include "packmast.h"
|
||||||
|
#include "packer.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -35,6 +38,12 @@
|
|||||||
|
|
||||||
static bool head_done = 0;
|
static bool head_done = 0;
|
||||||
|
|
||||||
|
#if defined(UPX_VERSION_GITREV)
|
||||||
|
const char gitrev[] = UPX_VERSION_GITREV;
|
||||||
|
#else
|
||||||
|
const char gitrev[1] = { 0 };
|
||||||
|
#endif
|
||||||
|
|
||||||
void show_head(void)
|
void show_head(void)
|
||||||
{
|
{
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
@@ -44,18 +53,19 @@ void show_head(void)
|
|||||||
return;
|
return;
|
||||||
head_done = 1;
|
head_done = 1;
|
||||||
|
|
||||||
#define V(x) (strcmp(UPX_VERSION_STRING, UPX_VERSION_STRING4) ? UPX_VERSION_STRING : UPX_VERSION_STRING x)
|
|
||||||
fg = con_fg(f,FG_GREEN);
|
fg = con_fg(f,FG_GREEN);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" Ultimate Packer for eXecutables\n"
|
" Ultimate Packer for eXecutables\n"
|
||||||
" Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006\n"
|
" Copyright (C) 1996 - " UPX_VERSION_YEAR "\n"
|
||||||
"UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
#if defined(UPX_VERSION_GITREV)
|
||||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32)
|
"UPX git-%6.6s%c"
|
||||||
V("d"),
|
#else
|
||||||
#elif (ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
|
"UPX %-11s"
|
||||||
V("w"),
|
#endif
|
||||||
#elif 0 && defined(__linux__)
|
" Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
||||||
V("l"),
|
#if defined(UPX_VERSION_GITREV)
|
||||||
|
gitrev,
|
||||||
|
(sizeof(gitrev)-1 > 6 && gitrev[sizeof(gitrev)-2] == '+') ? '+' : ' ',
|
||||||
#else
|
#else
|
||||||
UPX_VERSION_STRING,
|
UPX_VERSION_STRING,
|
||||||
#endif
|
#endif
|
||||||
@@ -76,7 +86,7 @@ void show_usage(void)
|
|||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
|
|
||||||
con_fprintf(f,"Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
|
con_fprintf(f,"Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
|
||||||
#if defined(__DJGPP__) || defined(__EMX__)
|
#if (ACC_OS_DOS32) && defined(__DJGPP__)
|
||||||
"[@]");
|
"[@]");
|
||||||
#else
|
#else
|
||||||
"");
|
"");
|
||||||
@@ -88,7 +98,79 @@ void show_usage(void)
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void show_help(int x)
|
struct PackerNames
|
||||||
|
{
|
||||||
|
struct Entry {
|
||||||
|
const char* fname;
|
||||||
|
const char* sname;
|
||||||
|
};
|
||||||
|
Entry names[64];
|
||||||
|
size_t names_count;
|
||||||
|
const options_t *o;
|
||||||
|
PackerNames() : names_count(0), o(nullptr) { }
|
||||||
|
void add(const Packer *p)
|
||||||
|
{
|
||||||
|
p->assertPacker();
|
||||||
|
assert(names_count < 64);
|
||||||
|
names[names_count].fname = p->getFullName(o);
|
||||||
|
names[names_count].sname = p->getName();
|
||||||
|
names_count++;
|
||||||
|
}
|
||||||
|
static Packer* visit(Packer *p, void *user)
|
||||||
|
{
|
||||||
|
PackerNames *self = (PackerNames *) user;
|
||||||
|
self->add(p);
|
||||||
|
delete p; p = nullptr;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
static int __acc_cdecl_qsort cmp_fname(const void *a, const void *b) {
|
||||||
|
return strcmp(((const Entry *) a)->fname, ((const Entry *) b)->fname);
|
||||||
|
}
|
||||||
|
static int __acc_cdecl_qsort cmp_sname(const void *a, const void *b) {
|
||||||
|
return strcmp(((const Entry *) a)->sname, ((const Entry *) b)->sname);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static void show_all_packers(FILE *f, int verbose)
|
||||||
|
{
|
||||||
|
options_t o; o.reset();
|
||||||
|
PackerNames pn; pn.o = &o;
|
||||||
|
PackMaster::visitAllPackers(PackerNames::visit, nullptr, &o, &pn);
|
||||||
|
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), PackerNames::cmp_fname);
|
||||||
|
size_t pos = 0;
|
||||||
|
for (size_t i = 0; i < pn.names_count; ++i)
|
||||||
|
{
|
||||||
|
const char *fn = pn.names[i].fname;
|
||||||
|
const char *sn = pn.names[i].sname;
|
||||||
|
if (verbose > 0)
|
||||||
|
{
|
||||||
|
con_fprintf(f, " %-36s %s\n", fn, sn);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t fl = strlen(fn);
|
||||||
|
if (pos == 0) {
|
||||||
|
con_fprintf(f, " %s", fn);
|
||||||
|
pos = 2 + fl;
|
||||||
|
} else if (pos + 1 + fl > 80) {
|
||||||
|
con_fprintf(f, "\n %s", fn);
|
||||||
|
pos = 2 + fl;
|
||||||
|
} else {
|
||||||
|
con_fprintf(f, " %s", fn);
|
||||||
|
pos += 1 + fl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (verbose <= 0 && pn.names_count)
|
||||||
|
con_fprintf(f, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
void show_help(int verbose)
|
||||||
{
|
{
|
||||||
FILE *f = con_term;
|
FILE *f = con_term;
|
||||||
int fg;
|
int fg;
|
||||||
@@ -105,8 +187,8 @@ void show_help(int x)
|
|||||||
" -d decompress -l list compressed file\n"
|
" -d decompress -l list compressed file\n"
|
||||||
" -t test compressed file -V display version number\n"
|
" -t test compressed file -V display version number\n"
|
||||||
" -h give %s help -L display software license\n%s",
|
" -h give %s help -L display software license\n%s",
|
||||||
x == 0 ? "" : " --best compress best (can be slow for big files)\n",
|
verbose == 0 ? "" : " --best compress best (can be slow for big files)\n",
|
||||||
x == 0 ? "more" : "this", x == 0 ? "" : "\n");
|
verbose == 0 ? "more" : "this", verbose == 0 ? "" : "\n");
|
||||||
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options:\n");
|
con_fprintf(f,"Options:\n");
|
||||||
@@ -114,22 +196,30 @@ void show_help(int x)
|
|||||||
|
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" -q be quiet -v be verbose\n"
|
" -q be quiet -v be verbose\n"
|
||||||
" -oFILE write output to `FILE'\n"
|
" -oFILE write output to 'FILE'\n"
|
||||||
//" -f force overwrite of output files and compression of suspicious files\n"
|
//" -f force overwrite of output files and compression of suspicious files\n"
|
||||||
" -f force compression of suspicious files\n"
|
" -f force compression of suspicious files\n"
|
||||||
"%s%s"
|
"%s%s"
|
||||||
, (x == 0) ? " -k keep backup files\n" : ""
|
, (verbose == 0) ? " -k keep backup files\n" : ""
|
||||||
#if 1
|
#if 1
|
||||||
, (x > 0) ? " --no-color, --mono, --color, --no-progress change look\n" : ""
|
, (verbose > 0) ? " --no-color, --mono, --color, --no-progress change look\n" : ""
|
||||||
#else
|
#else
|
||||||
, ""
|
, ""
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
if (x > 0)
|
if (verbose > 0)
|
||||||
{
|
{
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"\nBackup options:\n");
|
con_fprintf(f,"\nCompression tuning options:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --lzma try LZMA [slower but tighter than NRV]\n"
|
||||||
|
" --brute try all available compression methods & filters [slow]\n"
|
||||||
|
" --ultra-brute try even more compression variants [very slow]\n"
|
||||||
|
"\n");
|
||||||
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Backup options:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" -k, --backup keep backup files\n"
|
" -k, --backup keep backup files\n"
|
||||||
@@ -144,26 +234,16 @@ void show_help(int x)
|
|||||||
" --overlay=skip don't compress a file with an overlay\n"
|
" --overlay=skip don't compress a file with an overlay\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for atari/tos:\n");
|
|
||||||
fg = con_fg(f,fg);
|
|
||||||
con_fprintf(f,
|
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
"\n");
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
|
||||||
con_fprintf(f,"Options for djgpp2/coff:\n");
|
con_fprintf(f,"Options for djgpp2/coff:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --coff produce COFF output [default: EXE]\n"
|
" --coff produce COFF output [default: EXE]\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/com:\n");
|
con_fprintf(f,"Options for dos/com:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed com work on any 8086\n"
|
" --8086 make compressed com work on any 8086\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/exe:\n");
|
con_fprintf(f,"Options for dos/exe:\n");
|
||||||
@@ -171,56 +251,30 @@ void show_help(int x)
|
|||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed exe work on any 8086\n"
|
" --8086 make compressed exe work on any 8086\n"
|
||||||
" --no-reloc put no relocations in to the exe header\n"
|
" --no-reloc put no relocations in to the exe header\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/sys:\n");
|
con_fprintf(f,"Options for dos/sys:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed sys work on any 8086\n"
|
" --8086 make compressed sys work on any 8086\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
#if 0
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
|
||||||
con_fprintf(f,"Options for linux/386\n");
|
|
||||||
fg = con_fg(f,fg);
|
|
||||||
con_fprintf(f,
|
|
||||||
" --script use /usr/local/lib/upx/upx[bd] as decompressor\n"
|
|
||||||
" --script=/path/upxX use path/upxX as decompressor\n"
|
|
||||||
"\n");
|
|
||||||
#endif
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for ps1/exe:\n");
|
con_fprintf(f,"Options for ps1/exe:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --8-bit uses 8 bit size compression [default: 32 bit]\n"
|
" --8-bit uses 8 bit size compression [default: 32 bit]\n"
|
||||||
" --console-run enables client/host transfer compatibility\n"
|
" --8mib-ram 8 megabyte memory limit [default: 2 MiB]\n"
|
||||||
|
" --boot-only disables client/host transfer compatibility\n"
|
||||||
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
|
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for tmt/adam:\n");
|
|
||||||
fg = con_fg(f,fg);
|
|
||||||
con_fprintf(f,
|
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
|
||||||
con_fprintf(f,"Options for vmlinuz/386\n");
|
|
||||||
fg = con_fg(f,fg);
|
|
||||||
con_fprintf(f,
|
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
|
||||||
con_fprintf(f,"Options for watcom/le:\n");
|
con_fprintf(f,"Options for watcom/le:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --le produce LE output [default: EXE]\n"
|
" --le produce LE output [default: EXE]\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for win32/pe & rtm32/pe:\n");
|
con_fprintf(f,"Options for win32/pe, win64/pe, rtm32/pe & arm/pe:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --compress-exports=0 do not compress the export section\n"
|
" --compress-exports=0 do not compress the export section\n"
|
||||||
@@ -228,59 +282,45 @@ void show_help(int x)
|
|||||||
" --compress-icons=0 do not compress any icons\n"
|
" --compress-icons=0 do not compress any icons\n"
|
||||||
" --compress-icons=1 compress all but the first icon\n"
|
" --compress-icons=1 compress all but the first icon\n"
|
||||||
" --compress-icons=2 compress all but the first icon directory [default]\n"
|
" --compress-icons=2 compress all but the first icon directory [default]\n"
|
||||||
|
" --compress-icons=3 compress all icons\n"
|
||||||
" --compress-resources=0 do not compress any resources at all\n"
|
" --compress-resources=0 do not compress any resources at all\n"
|
||||||
|
" --keep-resource=list do not compress resources specified by list\n"
|
||||||
" --strip-relocs=0 do not strip relocations\n"
|
" --strip-relocs=0 do not strip relocations\n"
|
||||||
" --strip-relocs=1 strip relocations [default]\n"
|
" --strip-relocs=1 strip relocations [default]\n"
|
||||||
" --all-methods try all available compression methods\n"
|
"\n");
|
||||||
" --all-filters try all available preprocessing filters\n"
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Options for linux/elf:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
con_fprintf(f,
|
con_fprintf(f, "file.. executables to (de)compress\n");
|
||||||
"file.. executables to (de)compress\n"
|
|
||||||
"\n");
|
if (verbose > 0)
|
||||||
fg = con_fg(f,FG_YELLOW);
|
{
|
||||||
con_fprintf(f,"This version supports:\n");
|
fg = con_fg(f,FG_YELLOW);
|
||||||
fg = con_fg(f,fg);
|
con_fprintf(f,"\nThis version supports:\n");
|
||||||
con_fprintf(f," "
|
fg = con_fg(f,fg);
|
||||||
// TODO:
|
show_all_packers(f, verbose);
|
||||||
// support for mach/ppc32
|
}
|
||||||
// support for linux elf/ppc32
|
else
|
||||||
// support for linux elf/amd64
|
{
|
||||||
" arm/pe,"
|
con_fprintf(f,"\nType '%s --help' for more detailed help.\n", progname);
|
||||||
" atari/tos,"
|
}
|
||||||
" bvmlinuz/386,"
|
|
||||||
" djgpp2/coff,"
|
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit https://upx.github.io\n"
|
||||||
" dos/com,"
|
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
|
||||||
" dos/exe,"
|
|
||||||
" dos/sys,"
|
|
||||||
"\n "
|
|
||||||
//" elks/8086,"
|
|
||||||
" linux/amd64,"
|
|
||||||
" linux/i386,"
|
|
||||||
" linux/ppc32,"
|
|
||||||
" mach/ppc32,"
|
|
||||||
" ps1/exe,"
|
|
||||||
" rtm32/pe,"
|
|
||||||
"\n "
|
|
||||||
" tmt/adam,"
|
|
||||||
" vmlinux/386,"
|
|
||||||
" vmlinuz/386,"
|
|
||||||
" watcom/le,"
|
|
||||||
//" win16/ne,"
|
|
||||||
" win32/pe"
|
|
||||||
"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.sf.net\n"
|
|
||||||
// "\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n"
|
|
||||||
"");
|
"");
|
||||||
|
|
||||||
|
#if DEBUG || TESTING
|
||||||
#if defined(DEBUG) || defined(TESTING)
|
|
||||||
fg = con_fg(f,FG_RED);
|
fg = con_fg(f,FG_RED);
|
||||||
con_fprintf(f,"\nWARNING: this version is compiled with"
|
con_fprintf(f,"\nWARNING: this version is compiled with"
|
||||||
#if defined(DEBUG)
|
#if DEBUG
|
||||||
" -DDEBUG"
|
" -DDEBUG"
|
||||||
#endif
|
#endif
|
||||||
#if defined(TESTING)
|
#if TESTING
|
||||||
" -DTESTING"
|
" -DTESTING"
|
||||||
#endif
|
#endif
|
||||||
"\n");
|
"\n");
|
||||||
@@ -308,23 +348,23 @@ void show_license(void)
|
|||||||
" This program is distributed in the hope that it will be useful,\n"
|
" This program is distributed in the hope that it will be useful,\n"
|
||||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||||
" UPX License Agreement for more details.\n"
|
" UPX License Agreements for more details.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" You should have received a copy of the UPX License Agreement\n"
|
" You should have received a copy of the UPX License Agreements\n"
|
||||||
" along with this program; see the file LICENSE.\n"
|
" along with this program; see the files COPYING and LICENSE.\n"
|
||||||
" If not, visit one of the following pages:\n"
|
" If not, visit one of the following pages:\n"
|
||||||
"\n"
|
"\n"
|
||||||
);
|
);
|
||||||
int fg = con_fg(f,FG_CYAN);
|
int fg = con_fg(f,FG_CYAN);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" http://upx.sourceforge.net\n"
|
" https://upx.github.io\n"
|
||||||
" http://www.oberhumer.com/opensource/upx/\n"
|
" https://www.oberhumer.com/opensource/upx/\n"
|
||||||
);
|
);
|
||||||
(void)con_fg(f,FG_ORANGE);
|
(void)con_fg(f,FG_ORANGE);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
"\n"
|
"\n"
|
||||||
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
||||||
" <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>\n"
|
" <markus@oberhumer.com> <ezerotven+github@gmail.com>\n"
|
||||||
);
|
);
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
|
|
||||||
@@ -336,31 +376,55 @@ void show_license(void)
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void show_version(int x)
|
void show_version(bool one_line)
|
||||||
{
|
{
|
||||||
FILE *f = stdout;
|
FILE *fp = stdout;
|
||||||
UNUSED(x);
|
const char *v;
|
||||||
|
|
||||||
#if (0 && ACC_CC_GNUC)
|
fprintf(fp, "upx %s\n", UPX_VERSION_STRING
|
||||||
fprintf(f,"upx %s (gcc 0x%06lx)\n", UPX_VERSION_STRING, ACC_CC_GNUC);
|
#if defined(UPX_VERSION_GITREV)
|
||||||
#else
|
"-git-" UPX_VERSION_GITREV
|
||||||
fprintf(f,"upx %s\n", UPX_VERSION_STRING);
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
);
|
||||||
fprintf(f,"NRV data compression library %s\n", nrv_version_string());
|
if (one_line)
|
||||||
|
return;
|
||||||
|
#if (WITH_NRV)
|
||||||
|
v = upx_nrv_version_string();
|
||||||
|
if (v != nullptr && v[0])
|
||||||
|
fprintf(fp, "NRV data compression library %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
v = upx_ucl_version_string();
|
||||||
|
if (v != nullptr && v[0])
|
||||||
|
fprintf(fp, "UCL data compression library %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
fprintf(f,"Copyright (C) 1996-2006 Markus Franz Xaver Johannes Oberhumer\n");
|
#if (WITH_ZLIB)
|
||||||
fprintf(f,"Copyright (C) 1996-2006 Laszlo Molnar\n");
|
v = upx_zlib_version_string();
|
||||||
fprintf(f,"Copyright (C) 2000-2006 John F. Reiser\n");
|
if (v != nullptr && v[0])
|
||||||
fprintf(f,"Copyright (C) 2002-2006 Jens Medoch\n");
|
fprintf(fp, "zlib data compression library %s\n", v);
|
||||||
fprintf(f,"UPX comes with ABSOLUTELY NO WARRANTY; for details type `%s -L'.\n", progname);
|
#endif
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
v = upx_lzma_version_string();
|
||||||
|
if (v != nullptr && v[0])
|
||||||
|
fprintf(fp, "LZMA SDK version %s\n", v);
|
||||||
|
#endif
|
||||||
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
|
fprintf(fp, "doctest C++ testing framework version %s\n", DOCTEST_VERSION_STR);
|
||||||
|
#endif
|
||||||
|
fprintf(fp, "Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
|
fprintf(fp, "Copyright (C) 1996-2022 Laszlo Molnar\n");
|
||||||
|
fprintf(fp, "Copyright (C) 2000-2022 John F. Reiser\n");
|
||||||
|
fprintf(fp, "Copyright (C) 2002-2022 Jens Medoch\n");
|
||||||
|
#if (WITH_ZLIB)
|
||||||
|
fprintf(fp, "Copyright (C) 1995" "-2022 Jean-loup Gailly and Mark Adler\n");
|
||||||
|
#endif
|
||||||
|
#if (WITH_LZMA)
|
||||||
|
fprintf(fp, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
|
||||||
|
#endif
|
||||||
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
|
fprintf(fp, "Copyright (C) 2016" "-2021 Viktor Kirilov\n");
|
||||||
|
#endif
|
||||||
|
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+32
-29
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,18 +22,18 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "mem.h"
|
#include "util/membuffer.h"
|
||||||
#include "lefile.h"
|
#include "lefile.h"
|
||||||
|
|
||||||
|
|
||||||
LeFile::LeFile(InputFile *f) :
|
LeFile::LeFile(InputFile *f) :
|
||||||
fif(f), fof(NULL),
|
fif(f), fof(nullptr),
|
||||||
le_offset(0), exe_offset(0)
|
le_offset(0), exe_offset(0)
|
||||||
{
|
{
|
||||||
COMPILE_TIME_ASSERT(sizeof(le_header_t) == 196);
|
COMPILE_TIME_ASSERT(sizeof(le_header_t) == 196);
|
||||||
@@ -41,13 +41,13 @@ LeFile::LeFile(InputFile *f) :
|
|||||||
COMPILE_TIME_ASSERT(sizeof(le_pagemap_entry_t) == 4);
|
COMPILE_TIME_ASSERT(sizeof(le_pagemap_entry_t) == 4);
|
||||||
memset(&ih,0,sizeof ih);
|
memset(&ih,0,sizeof ih);
|
||||||
memset(&oh,0,sizeof oh);
|
memset(&oh,0,sizeof oh);
|
||||||
iobject_table = oobject_table = NULL;
|
iobject_table = oobject_table = nullptr;
|
||||||
ifpage_table = ofpage_table = NULL;
|
ifpage_table = ofpage_table = nullptr;
|
||||||
ipm_entries = opm_entries = NULL;
|
ipm_entries = opm_entries = nullptr;
|
||||||
ires_names = ores_names = NULL;
|
ires_names = ores_names = nullptr;
|
||||||
ifixups = ofixups = NULL;
|
ifixups = ofixups = nullptr;
|
||||||
inonres_names = ononres_names = NULL;
|
inonres_names = ononres_names = nullptr;
|
||||||
ientries = oentries = NULL;
|
ientries = oentries = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +77,8 @@ LeFile::~LeFile()
|
|||||||
|
|
||||||
void LeFile::readObjectTable()
|
void LeFile::readObjectTable()
|
||||||
{
|
{
|
||||||
iobject_table = new le_object_table_entry_t[soobject_table = objects];
|
soobject_table = objects;
|
||||||
|
iobject_table = New(le_object_table_entry_t, soobject_table);
|
||||||
fif->seek(le_offset + ih.object_table_offset,SEEK_SET);
|
fif->seek(le_offset + ih.object_table_offset,SEEK_SET);
|
||||||
fif->readx(iobject_table,sizeof(*iobject_table)*objects);
|
fif->readx(iobject_table,sizeof(*iobject_table)*objects);
|
||||||
}
|
}
|
||||||
@@ -92,7 +93,8 @@ void LeFile::writeObjectTable()
|
|||||||
|
|
||||||
void LeFile::readPageMap()
|
void LeFile::readPageMap()
|
||||||
{
|
{
|
||||||
ipm_entries = new le_pagemap_entry_t[sopm_entries = pages];
|
sopm_entries = pages;
|
||||||
|
ipm_entries = New(le_pagemap_entry_t, sopm_entries);
|
||||||
fif->seek(le_offset + ih.object_pagemap_offset,SEEK_SET);
|
fif->seek(le_offset + ih.object_pagemap_offset,SEEK_SET);
|
||||||
fif->readx(ipm_entries,sizeof(*ipm_entries)*pages);
|
fif->readx(ipm_entries,sizeof(*ipm_entries)*pages);
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ void LeFile::writePageMap()
|
|||||||
void LeFile::readResidentNames()
|
void LeFile::readResidentNames()
|
||||||
{
|
{
|
||||||
sores_names = ih.entry_table_offset - ih.resident_names_offset;
|
sores_names = ih.entry_table_offset - ih.resident_names_offset;
|
||||||
ires_names = new upx_byte[sores_names];
|
ires_names = New(upx_byte, sores_names);
|
||||||
fif->seek(le_offset+ih.resident_names_offset,SEEK_SET);
|
fif->seek(le_offset+ih.resident_names_offset,SEEK_SET);
|
||||||
fif->readx(ires_names,sores_names);
|
fif->readx(ires_names,sores_names);
|
||||||
}
|
}
|
||||||
@@ -129,7 +131,7 @@ void LeFile::readEntryTable()
|
|||||||
{
|
{
|
||||||
soentries = ih.fixup_page_table_offset - ih.entry_table_offset;
|
soentries = ih.fixup_page_table_offset - ih.entry_table_offset;
|
||||||
fif->seek(le_offset + ih.entry_table_offset,SEEK_SET);
|
fif->seek(le_offset + ih.entry_table_offset,SEEK_SET);
|
||||||
ientries = new upx_byte[soentries];
|
ientries = New(upx_byte, soentries);
|
||||||
fif->readx(ientries,soentries);
|
fif->readx(ientries,soentries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +145,8 @@ void LeFile::writeEntryTable()
|
|||||||
|
|
||||||
void LeFile::readFixupPageTable()
|
void LeFile::readFixupPageTable()
|
||||||
{
|
{
|
||||||
ifpage_table = new unsigned[sofpage_table = 1+pages];
|
sofpage_table = 1+pages;
|
||||||
|
ifpage_table = New(unsigned, sofpage_table);
|
||||||
fif->seek(le_offset + ih.fixup_page_table_offset,SEEK_SET);
|
fif->seek(le_offset + ih.fixup_page_table_offset,SEEK_SET);
|
||||||
fif->readx(ifpage_table,4*sofpage_table);
|
fif->readx(ifpage_table,4*sofpage_table);
|
||||||
}
|
}
|
||||||
@@ -159,7 +162,7 @@ void LeFile::writeFixupPageTable()
|
|||||||
void LeFile::readFixups()
|
void LeFile::readFixups()
|
||||||
{
|
{
|
||||||
sofixups = get_le32(ifpage_table+pages)-get_le32(ifpage_table);
|
sofixups = get_le32(ifpage_table+pages)-get_le32(ifpage_table);
|
||||||
ifixups = new upx_byte[sofixups];
|
ifixups = New(upx_byte, sofixups);
|
||||||
fif->seek(le_offset + ih.fixup_record_table_offset,SEEK_SET);
|
fif->seek(le_offset + ih.fixup_record_table_offset,SEEK_SET);
|
||||||
fif->readx(ifixups,sofixups);
|
fif->readx(ifixups,sofixups);
|
||||||
}
|
}
|
||||||
@@ -187,8 +190,9 @@ unsigned LeFile::getImageSize() const
|
|||||||
void LeFile::readImage()
|
void LeFile::readImage()
|
||||||
{
|
{
|
||||||
soimage = pages*mps;
|
soimage = pages*mps;
|
||||||
iimage.alloc(soimage);
|
mb_iimage.alloc(soimage);
|
||||||
memset(iimage,0,soimage);
|
mb_iimage.clear();
|
||||||
|
iimage = mb_iimage;
|
||||||
|
|
||||||
unsigned ic,jc;
|
unsigned ic,jc;
|
||||||
for (ic = jc = 0; ic < pages; ic++)
|
for (ic = jc = 0; ic < pages; ic++)
|
||||||
@@ -197,7 +201,8 @@ void LeFile::readImage()
|
|||||||
{
|
{
|
||||||
fif->seek(ih.data_pages_offset + exe_offset +
|
fif->seek(ih.data_pages_offset + exe_offset +
|
||||||
(ipm_entries[ic].m*0x100 + ipm_entries[ic].l-1) * mps,SEEK_SET);
|
(ipm_entries[ic].m*0x100 + ipm_entries[ic].l-1) * mps,SEEK_SET);
|
||||||
fif->readx(iimage+jc,ic != pages-1 ? mps : ih.bytes_on_last_page);
|
auto bytes = ic != pages-1 ? mps : ih.bytes_on_last_page;
|
||||||
|
fif->readx(raw_bytes(iimage+jc, bytes), bytes);
|
||||||
}
|
}
|
||||||
jc += mps;
|
jc += mps;
|
||||||
}
|
}
|
||||||
@@ -206,8 +211,8 @@ void LeFile::readImage()
|
|||||||
|
|
||||||
void LeFile::writeImage()
|
void LeFile::writeImage()
|
||||||
{
|
{
|
||||||
if (fof && oimage != NULL)
|
if (fof && oimage != nullptr)
|
||||||
fof->write(oimage, soimage);
|
fof->write(raw_bytes(oimage, soimage), soimage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -215,7 +220,8 @@ void LeFile::readNonResidentNames()
|
|||||||
{
|
{
|
||||||
if (ih.non_resident_name_table_length)
|
if (ih.non_resident_name_table_length)
|
||||||
{
|
{
|
||||||
inonres_names = new upx_byte[sononres_names = ih.non_resident_name_table_length];
|
sononres_names = ih.non_resident_name_table_length;
|
||||||
|
inonres_names = New(upx_byte, sononres_names);
|
||||||
fif->seek(exe_offset+ih.non_resident_name_table_offset,SEEK_SET);
|
fif->seek(exe_offset+ih.non_resident_name_table_offset,SEEK_SET);
|
||||||
fif->readx(inonres_names,sononres_names);
|
fif->readx(inonres_names,sononres_names);
|
||||||
}
|
}
|
||||||
@@ -338,6 +344,7 @@ void LeFile::countFixups(unsigned *counts) const
|
|||||||
break;
|
break;
|
||||||
case 6: // 16:32 pointer
|
case 6: // 16:32 pointer
|
||||||
counts[o] += 9;
|
counts[o] += 9;
|
||||||
|
// fall through
|
||||||
case 7: // 32-bit offset
|
case 7: // 32-bit offset
|
||||||
counts[fix[4]-1] += 4;
|
counts[fix[4]-1] += 4;
|
||||||
fix += (fix[1] & 0x10) ? 9 : 7;
|
fix += (fix[1] & 0x10) ? 9 : 7;
|
||||||
@@ -360,8 +367,4 @@ void LeFile::countFixups(unsigned *counts) const
|
|||||||
counts[o+1] += 4; // extra space for 0xFFFFFFFF
|
counts[o+1] += 4; // extra space for 0xFFFFFFFF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+30
-37
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,12 +22,12 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_LEFILE_H
|
#ifndef __UPX_LEFILE_H
|
||||||
#define __UPX_LEFILE_H
|
#define __UPX_LEFILE_H 1
|
||||||
|
|
||||||
class InputFile;
|
class InputFile;
|
||||||
class OutputFile;
|
class OutputFile;
|
||||||
@@ -39,7 +39,7 @@ class OutputFile;
|
|||||||
|
|
||||||
class LeFile
|
class LeFile
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
LeFile(InputFile *);
|
LeFile(InputFile *);
|
||||||
virtual ~LeFile();
|
virtual ~LeFile();
|
||||||
|
|
||||||
@@ -49,8 +49,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
enum { FIXUP_EXTRA = 3 };
|
enum { FIXUP_EXTRA = 3 };
|
||||||
|
|
||||||
struct le_header_t
|
__packed_struct(le_header_t)
|
||||||
{ // 0x00
|
// 0x00
|
||||||
char _[2]; // signature: 'LE' || 'LX'
|
char _[2]; // signature: 'LE' || 'LX'
|
||||||
char byte_order; // 0 little endian
|
char byte_order; // 0 little endian
|
||||||
char word_order; // 0 little endian
|
char word_order; // 0 little endian
|
||||||
@@ -112,72 +112,67 @@ protected:
|
|||||||
LE32 extra_heap_alloc;
|
LE32 extra_heap_alloc;
|
||||||
char reserved[12];
|
char reserved[12];
|
||||||
LE32 versioninfo;
|
LE32 versioninfo;
|
||||||
LE32 unkown;
|
LE32 unknown;
|
||||||
// 0xC0
|
// 0xC0
|
||||||
LE16 device_id;
|
LE16 device_id;
|
||||||
LE16 ddk_version;
|
LE16 ddk_version;
|
||||||
#endif
|
#endif
|
||||||
}
|
__packed_struct_end()
|
||||||
__attribute_packed;
|
|
||||||
|
|
||||||
struct le_object_table_entry_t
|
__packed_struct(le_object_table_entry_t)
|
||||||
{
|
|
||||||
LE32 virtual_size;
|
LE32 virtual_size;
|
||||||
LE32 base_address;
|
LE32 base_address;
|
||||||
LE32 flags;
|
LE32 flags;
|
||||||
LE32 pagemap_index;
|
LE32 pagemap_index;
|
||||||
LE32 npages;
|
LE32 npages;
|
||||||
LE32 reserved;
|
LE32 reserved;
|
||||||
}
|
__packed_struct_end()
|
||||||
__attribute_packed;
|
|
||||||
|
|
||||||
struct le_pagemap_entry_t
|
__packed_struct(le_pagemap_entry_t)
|
||||||
{
|
|
||||||
unsigned char h;
|
unsigned char h;
|
||||||
unsigned char m;
|
unsigned char m;
|
||||||
unsigned char l;
|
unsigned char l;
|
||||||
unsigned char type; // 0x00-legal;0x40-iterated;0x80-invalid;0xC0-zeroed
|
unsigned char type; // 0x00-legal;0x40-iterated;0x80-invalid;0xC0-zeroed
|
||||||
}
|
__packed_struct_end()
|
||||||
__attribute_packed;
|
|
||||||
|
|
||||||
virtual void readObjectTable();
|
virtual void readObjectTable();
|
||||||
virtual void writeObjectTable();
|
virtual void writeObjectTable();
|
||||||
//virtual void encodeObjectTable(){oobject_table = iobject_table; iobject_table = NULL;}
|
//virtual void encodeObjectTable(){oobject_table = iobject_table; iobject_table = nullptr;}
|
||||||
//virtual void decodeObjectTable(){encodeObjectTable();}
|
//virtual void decodeObjectTable(){encodeObjectTable();}
|
||||||
|
|
||||||
virtual void readFixupPageTable();
|
virtual void readFixupPageTable();
|
||||||
virtual void writeFixupPageTable();
|
virtual void writeFixupPageTable();
|
||||||
//virtual void encodeFixupPageTable(){ofpage_table = ifpage_table; ifpage_table = NULL;}
|
//virtual void encodeFixupPageTable(){ofpage_table = ifpage_table; ifpage_table = nullptr;}
|
||||||
//virtual void decodeFixupPageTable(){encodeFixupPageTable();}
|
//virtual void decodeFixupPageTable(){encodeFixupPageTable();}
|
||||||
|
|
||||||
virtual void readPageMap();
|
virtual void readPageMap();
|
||||||
virtual void writePageMap();
|
virtual void writePageMap();
|
||||||
virtual void encodePageMap(){opm_entries = ipm_entries; ipm_entries = NULL;}
|
virtual void encodePageMap(){opm_entries = ipm_entries; ipm_entries = nullptr;}
|
||||||
virtual void decodePageMap(){encodePageMap();}
|
virtual void decodePageMap(){encodePageMap();}
|
||||||
|
|
||||||
virtual void readResidentNames();
|
virtual void readResidentNames();
|
||||||
virtual void writeResidentNames();
|
virtual void writeResidentNames();
|
||||||
virtual void encodeResidentNames(){ores_names = ires_names; ires_names = NULL;}
|
virtual void encodeResidentNames(){ores_names = ires_names; ires_names = nullptr;}
|
||||||
virtual void decodeResidentNames(){encodeResidentNames();}
|
virtual void decodeResidentNames(){encodeResidentNames();}
|
||||||
|
|
||||||
virtual void readNonResidentNames();
|
virtual void readNonResidentNames();
|
||||||
virtual void writeNonResidentNames();
|
virtual void writeNonResidentNames();
|
||||||
virtual void encodeNonResidentNames(){ononres_names = inonres_names; inonres_names = NULL;}
|
virtual void encodeNonResidentNames(){ononres_names = inonres_names; inonres_names = nullptr;}
|
||||||
virtual void decodeNonResidentNames(){encodeNonResidentNames();}
|
virtual void decodeNonResidentNames(){encodeNonResidentNames();}
|
||||||
|
|
||||||
virtual void readEntryTable();
|
virtual void readEntryTable();
|
||||||
virtual void writeEntryTable();
|
virtual void writeEntryTable();
|
||||||
//virtual void encodeEntryTable(){oentries = ientries; ientries = NULL;}
|
//virtual void encodeEntryTable(){oentries = ientries; ientries = nullptr;}
|
||||||
//virtual void decodeEntryTable(){encodeEntryTable();}
|
//virtual void decodeEntryTable(){encodeEntryTable();}
|
||||||
|
|
||||||
virtual void readFixups();
|
virtual void readFixups();
|
||||||
virtual void writeFixups();
|
virtual void writeFixups();
|
||||||
//virtual void encodeFixups(){ofixups = ifixups; ifixups = NULL;}
|
//virtual void encodeFixups(){ofixups = ifixups; ifixups = nullptr;}
|
||||||
//virtual void decodeFixups(){encodeFixups();}
|
//virtual void decodeFixups(){encodeFixups();}
|
||||||
|
|
||||||
virtual void readImage();
|
virtual void readImage();
|
||||||
virtual void writeImage();
|
virtual void writeImage();
|
||||||
//virtual void encodeImage(){oimage = iimage; iimage = NULL;}
|
//virtual void encodeImage(){oimage = iimage; iimage = nullptr;}
|
||||||
//virtual void decodeImage(){encodeImage();}
|
//virtual void decodeImage(){encodeImage();}
|
||||||
|
|
||||||
void countFixups(unsigned *) const;
|
void countFixups(unsigned *) const;
|
||||||
@@ -185,8 +180,8 @@ protected:
|
|||||||
|
|
||||||
InputFile *fif;
|
InputFile *fif;
|
||||||
OutputFile *fof;
|
OutputFile *fof;
|
||||||
long le_offset;
|
unsigned le_offset;
|
||||||
long exe_offset;
|
unsigned exe_offset;
|
||||||
|
|
||||||
le_header_t ih;
|
le_header_t ih;
|
||||||
le_header_t oh;
|
le_header_t oh;
|
||||||
@@ -203,8 +198,10 @@ protected:
|
|||||||
upx_byte *ofixups;
|
upx_byte *ofixups;
|
||||||
upx_byte *inonres_names;
|
upx_byte *inonres_names;
|
||||||
upx_byte *ononres_names;
|
upx_byte *ononres_names;
|
||||||
MemBuffer iimage;
|
MemBuffer mb_iimage;
|
||||||
MemBuffer oimage;
|
SPAN_0(upx_byte) iimage = nullptr;
|
||||||
|
MemBuffer mb_oimage;
|
||||||
|
SPAN_0(upx_byte) oimage = nullptr;
|
||||||
upx_byte *ientries;
|
upx_byte *ientries;
|
||||||
upx_byte *oentries;
|
upx_byte *oentries;
|
||||||
|
|
||||||
@@ -219,15 +216,11 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// disable copy and assignment
|
// disable copy and assignment
|
||||||
LeFile(const LeFile &); // {}
|
LeFile(const LeFile &) = delete;
|
||||||
LeFile& operator= (const LeFile &); // { return *this; }
|
LeFile& operator= (const LeFile &) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+836
-175
File diff suppressed because it is too large
Load Diff
+238
-57
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -21,77 +21,258 @@
|
|||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@cdata.tvnet.hu
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_LINKER_H
|
#ifndef __UPX_LINKER_H
|
||||||
#define __UPX_LINKER_H
|
#define __UPX_LINKER_H 1
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// ElfLinker
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
class ElfLinker : private noncopyable {
|
||||||
|
friend class Packer;
|
||||||
|
|
||||||
class Linker
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Linker(const void *pdata, int plen, int pinfo);
|
const N_BELE_RTP::AbstractPolicy *bele = nullptr; // target endianness
|
||||||
virtual ~Linker();
|
protected:
|
||||||
int addSection(const char *sect);
|
struct Section;
|
||||||
void addSection(const char *sname, const void *sdata, unsigned len);
|
struct Symbol;
|
||||||
const char *getLoader(int *llen);
|
struct Relocation;
|
||||||
int getSection(const char *name, int *slen) const;
|
|
||||||
int getLoaderSize() const { return olen; }
|
upx_byte *input = nullptr;
|
||||||
void setLoaderAlignOffset(int phase);
|
int inputlen = 0;
|
||||||
|
upx_byte *output = nullptr;
|
||||||
|
int outputlen = 0;
|
||||||
|
|
||||||
|
Section *head = nullptr;
|
||||||
|
Section *tail = nullptr;
|
||||||
|
|
||||||
|
Section **sections = nullptr;
|
||||||
|
Symbol **symbols = nullptr;
|
||||||
|
Relocation **relocations = nullptr;
|
||||||
|
|
||||||
|
unsigned nsections = 0;
|
||||||
|
unsigned nsections_capacity = 0;
|
||||||
|
unsigned nsymbols = 0;
|
||||||
|
unsigned nsymbols_capacity = 0;
|
||||||
|
unsigned nrelocations = 0;
|
||||||
|
unsigned nrelocations_capacity = 0;
|
||||||
|
|
||||||
|
bool reloc_done = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// little endian
|
void preprocessSections(char *start, char const *end);
|
||||||
virtual unsigned get32(const void *b) const { return get_le32(b); }
|
void preprocessSymbols(char *start, char const *end);
|
||||||
virtual void set32(void *b, unsigned v) const { set_le32(b, v); }
|
void preprocessRelocations(char *start, char const *end);
|
||||||
|
Section *findSection(const char *name, bool fatal = true) const;
|
||||||
|
Symbol *findSymbol(const char *name, bool fatal = true) const;
|
||||||
|
|
||||||
private:
|
Symbol *addSymbol(const char *name, const char *section, upx_uint64_t offset);
|
||||||
struct section;
|
Relocation *addRelocation(const char *section, unsigned off, const char *type,
|
||||||
struct jump;
|
const char *symbol, upx_uint64_t add);
|
||||||
|
|
||||||
char *iloader, *oloader;
|
|
||||||
int ilen, olen;
|
|
||||||
int info;
|
|
||||||
jump *jumps;
|
|
||||||
int njumps;
|
|
||||||
section *sections;
|
|
||||||
int nsections;
|
|
||||||
int frozen;
|
|
||||||
int align_hack;
|
|
||||||
int align_offset;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// disable copy and assignment
|
|
||||||
Linker(const Linker &); // {}
|
|
||||||
Linker& operator= (const Linker &); // { return *this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class BeLinker : public Linker
|
|
||||||
{
|
|
||||||
typedef Linker super;
|
|
||||||
public:
|
public:
|
||||||
BeLinker(const void *pdata, int plen, int pinfo) :
|
ElfLinker();
|
||||||
super(pdata, plen, pinfo) { }
|
virtual ~ElfLinker();
|
||||||
|
|
||||||
|
void init(const void *pdata, int plen, unsigned pxtra = 0);
|
||||||
|
// virtual void setLoaderAlignOffset(int phase);
|
||||||
|
int addLoader(const char *sname);
|
||||||
|
void addLoader(const char *s, va_list ap);
|
||||||
|
#if (ACC_CC_CLANG || ACC_CC_GNUC)
|
||||||
|
void addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
|
||||||
|
#else
|
||||||
|
void addLoaderVA(const char *s, ...);
|
||||||
|
#endif
|
||||||
|
Section *addSection(const char *sname, const void *sdata, int slen, unsigned p2align);
|
||||||
|
int getSection(const char *sname, int *slen = nullptr) const;
|
||||||
|
int getSectionSize(const char *sname) const;
|
||||||
|
upx_byte *getLoader(int *llen = nullptr) const;
|
||||||
|
void defineSymbol(const char *name, upx_uint64_t value);
|
||||||
|
upx_uint64_t getSymbolOffset(const char *) const;
|
||||||
|
|
||||||
|
void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
|
||||||
|
void dumpSymbols(unsigned flags = 0, FILE *fp = nullptr) const;
|
||||||
|
|
||||||
|
void alignWithByte(unsigned len, unsigned char b);
|
||||||
|
virtual void alignCode(unsigned len) { alignWithByte(len, 0); }
|
||||||
|
virtual void alignData(unsigned len) { alignWithByte(len, 0); }
|
||||||
|
|
||||||
|
// provide overloads to pacify GitHub CodeQL
|
||||||
|
void defineSymbol(const char *name, int value) { defineSymbol(name, upx_uint64_t(value)); }
|
||||||
|
void defineSymbol(const char *name, unsigned value) { defineSymbol(name, upx_uint64_t(value)); }
|
||||||
|
void defineSymbol(const char *name, unsigned long value) {
|
||||||
|
defineSymbol(name, upx_uint64_t(value));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// big endian
|
void relocate();
|
||||||
virtual unsigned get32(const void *b) const { return get_be32(b); }
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
virtual void set32(void *b, unsigned v) const { set_be32(b, v); }
|
const char *type);
|
||||||
|
|
||||||
private:
|
// target endianness abstraction
|
||||||
// disable copy and assignment
|
unsigned get_te16(const void *p) const { return bele->get16(p); }
|
||||||
BeLinker(const BeLinker &); // {}
|
unsigned get_te32(const void *p) const { return bele->get32(p); }
|
||||||
BeLinker& operator= (const BeLinker &); // { return *this; }
|
upx_uint64_t get_te64(const void *p) const { return bele->get64(p); }
|
||||||
|
void set_te16(void *p, unsigned v) const { bele->set16(p, v); }
|
||||||
|
void set_te32(void *p, unsigned v) const { bele->set32(p, v); }
|
||||||
|
void set_te64(void *p, upx_uint64_t v) const { bele->set64(p, v); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Section : private noncopyable {
|
||||||
|
char *name = nullptr;
|
||||||
|
void *input = nullptr;
|
||||||
|
upx_byte *output = nullptr;
|
||||||
|
unsigned size = 0;
|
||||||
|
upx_uint64_t offset = 0;
|
||||||
|
unsigned p2align = 0; // log2
|
||||||
|
Section *next = nullptr;
|
||||||
|
|
||||||
|
Section(const char *n, const void *i, unsigned s, unsigned a = 0);
|
||||||
|
~Section();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Symbol : private noncopyable {
|
||||||
|
char *name = nullptr;
|
||||||
|
Section *section = nullptr;
|
||||||
|
upx_uint64_t offset = 0;
|
||||||
|
|
||||||
|
Symbol(const char *n, Section *s, upx_uint64_t o);
|
||||||
|
~Symbol();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ElfLinker::Relocation : private noncopyable {
|
||||||
|
const Section *section = nullptr;
|
||||||
|
unsigned offset = 0;
|
||||||
|
const char *type = nullptr;
|
||||||
|
const Symbol *value = nullptr;
|
||||||
|
upx_uint64_t add; // used in .rela relocations
|
||||||
|
|
||||||
|
Relocation(const Section *s, unsigned o, const char *t, const Symbol *v, upx_uint64_t a);
|
||||||
|
};
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// ElfLinker arch subclasses
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
class ElfLinkerAMD64 : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void alignCode(unsigned len) override { alignWithByte(len, 0x90); }
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerARM64 final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void alignCode(unsigned len) override { alignWithByte(len, 0x90); }
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArmBE final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElfLinkerArmBE() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArmLE final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerArm64LE final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerM68k final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElfLinkerM68k() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void alignCode(unsigned len) override;
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerMipsBE final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElfLinkerMipsBE() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerMipsLE final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerPpc32 final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElfLinkerPpc32() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerPpc64le final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerPpc64 final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ElfLinkerPpc64() { bele = &N_BELE_RTP::be_policy; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ElfLinkerX86 final : public ElfLinker {
|
||||||
|
typedef ElfLinker super;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void alignCode(unsigned len) override { alignWithByte(len, 0x90); }
|
||||||
|
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
|
||||||
|
const char *type) override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* already included */
|
#endif /* already included */
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
+660
-666
File diff suppressed because it is too large
Load Diff
-205
@@ -1,205 +0,0 @@
|
|||||||
/* mem.cpp --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "conf.h"
|
|
||||||
#include "mem.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
static int use_mcheck = -1;
|
|
||||||
|
|
||||||
static int mcheck_init()
|
|
||||||
{
|
|
||||||
if (use_mcheck < 0)
|
|
||||||
{
|
|
||||||
use_mcheck = 1;
|
|
||||||
#if defined(WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
|
|
||||||
if (RUNNING_ON_VALGRIND)
|
|
||||||
{
|
|
||||||
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
|
|
||||||
use_mcheck = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return use_mcheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
MemBuffer::MemBuffer() :
|
|
||||||
b(NULL), b_size(0)
|
|
||||||
{
|
|
||||||
if (use_mcheck < 0)
|
|
||||||
mcheck_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
MemBuffer::MemBuffer(unsigned size) :
|
|
||||||
b(NULL), b_size(0)
|
|
||||||
{
|
|
||||||
alloc(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MemBuffer::~MemBuffer()
|
|
||||||
{
|
|
||||||
this->dealloc();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemBuffer::dealloc()
|
|
||||||
{
|
|
||||||
if (b)
|
|
||||||
{
|
|
||||||
checkState();
|
|
||||||
if (use_mcheck)
|
|
||||||
{
|
|
||||||
// remove magic constants
|
|
||||||
set_be32(b - 8, 0);
|
|
||||||
set_be32(b - 4, 0);
|
|
||||||
set_be32(b + b_size, 0);
|
|
||||||
set_be32(b + b_size + 4, 0);
|
|
||||||
//
|
|
||||||
::free(b - 16);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
::free(b);
|
|
||||||
b = NULL;
|
|
||||||
b_size = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
assert(b_size == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::allocForCompression(unsigned uncompressed_size, unsigned extra)
|
|
||||||
{
|
|
||||||
assert((int)uncompressed_size > 0);
|
|
||||||
assert((int)extra >= 0);
|
|
||||||
unsigned size = uncompressed_size + uncompressed_size/8 + 256 + extra;
|
|
||||||
alloc(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::allocForUncompression(unsigned uncompressed_size, unsigned extra)
|
|
||||||
{
|
|
||||||
assert((int)uncompressed_size > 0);
|
|
||||||
assert((int)extra >= 0);
|
|
||||||
unsigned size = uncompressed_size + extra;
|
|
||||||
// size += 512; // 512 safety bytes
|
|
||||||
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
|
|
||||||
#if (ACC_ARCH_I386)
|
|
||||||
size += 3;
|
|
||||||
#endif
|
|
||||||
alloc(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::fill(unsigned off, unsigned len, int value)
|
|
||||||
{
|
|
||||||
checkState();
|
|
||||||
assert((int)off >= 0);
|
|
||||||
assert((int)len >= 0);
|
|
||||||
assert(off <= b_size);
|
|
||||||
assert(len <= b_size);
|
|
||||||
assert(off + len <= b_size);
|
|
||||||
if (len > 0)
|
|
||||||
memset(b + off, value, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#define PTR(p) ((unsigned) ((acc_uintptr_t)(p) & 0xffffffff))
|
|
||||||
#define MAGIC1(p) (PTR(p) ^ 0xfefdbeeb)
|
|
||||||
#define MAGIC2(p) (PTR(p) ^ 0xfefdbeeb ^ 0x80024001)
|
|
||||||
|
|
||||||
unsigned MemBuffer::global_alloc_counter = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::checkState() const
|
|
||||||
{
|
|
||||||
if (!b)
|
|
||||||
throwInternalError("block not allocated");
|
|
||||||
if (use_mcheck)
|
|
||||||
{
|
|
||||||
if (get_be32(b - 4) != MAGIC1(b))
|
|
||||||
throwInternalError("memory clobbered before allocated block 1");
|
|
||||||
if (get_be32(b - 8) != b_size)
|
|
||||||
throwInternalError("memory clobbered before allocated block 2");
|
|
||||||
if (get_be32(b + b_size) != MAGIC2(b))
|
|
||||||
throwInternalError("memory clobbered past end of allocated block");
|
|
||||||
}
|
|
||||||
assert((int)b_size > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MemBuffer::alloc(unsigned size)
|
|
||||||
{
|
|
||||||
if (use_mcheck < 0)
|
|
||||||
mcheck_init();
|
|
||||||
|
|
||||||
// NOTE: we don't automatically free a used buffer
|
|
||||||
assert(b == NULL);
|
|
||||||
assert(b_size == 0);
|
|
||||||
//
|
|
||||||
assert((int)size > 0);
|
|
||||||
unsigned total = use_mcheck ? size + 32 : size;
|
|
||||||
assert((int)total > 0);
|
|
||||||
unsigned char *p = (unsigned char *) malloc(total);
|
|
||||||
if (!p)
|
|
||||||
{
|
|
||||||
//throw bad_alloc();
|
|
||||||
throw OutOfMemoryException("out of memory");
|
|
||||||
//exit(1);
|
|
||||||
}
|
|
||||||
b_size = size;
|
|
||||||
if (use_mcheck)
|
|
||||||
{
|
|
||||||
b = p + 16;
|
|
||||||
// store magic constants to detect buffer overruns
|
|
||||||
set_be32(b - 8, b_size);
|
|
||||||
set_be32(b - 4, MAGIC1(b));
|
|
||||||
set_be32(b + b_size, MAGIC2(b));
|
|
||||||
set_be32(b + b_size + 4, global_alloc_counter++);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
b = p ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/* mem.h --
|
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
|
||||||
All Rights Reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
|
||||||
and/or modify them under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; see the file COPYING.
|
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_MEM_H
|
|
||||||
#define __UPX_MEM_H
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
//
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
class MemBuffer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MemBuffer();
|
|
||||||
MemBuffer(unsigned size);
|
|
||||||
~MemBuffer();
|
|
||||||
|
|
||||||
void alloc(unsigned size);
|
|
||||||
void allocForCompression(unsigned uncompressed_size, unsigned extra=0);
|
|
||||||
void allocForUncompression(unsigned uncompressed_size, unsigned extra=0);
|
|
||||||
|
|
||||||
void dealloc();
|
|
||||||
|
|
||||||
void checkState() const;
|
|
||||||
|
|
||||||
unsigned getSize() const { return b_size; }
|
|
||||||
|
|
||||||
operator unsigned char * () { return b; }
|
|
||||||
//operator const unsigned char * () const { return b; }
|
|
||||||
void *getVoidPtr() { return (void *) b; }
|
|
||||||
const void *getVoidPtr() const { return (const void *) b; }
|
|
||||||
|
|
||||||
void fill(unsigned off, unsigned len, int value);
|
|
||||||
void clear(unsigned off, unsigned len) { fill(off, len, 0); }
|
|
||||||
void clear() { fill(0, b_size, 0); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned char *b;
|
|
||||||
unsigned b_size;
|
|
||||||
|
|
||||||
static unsigned global_alloc_counter;
|
|
||||||
|
|
||||||
// disable copy and assignment
|
|
||||||
MemBuffer(const MemBuffer &); // {}
|
|
||||||
MemBuffer& operator= (const MemBuffer &); // { return *this; }
|
|
||||||
|
|
||||||
// disable dynamic allocation
|
|
||||||
DISABLE_NEW_DELETE
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* already included */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et
|
|
||||||
*/
|
|
||||||
|
|
||||||
+3800
-2135
File diff suppressed because it is too large
Load Diff
+21
-25
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2022 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2004 Laszlo Molnar
|
Copyright (C) 1996-2022 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -55,9 +55,9 @@ void printClearLine(FILE *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout); fflush(stderr);
|
fflush(stdout); fflush(stderr);
|
||||||
if (f == NULL)
|
if (f == nullptr)
|
||||||
f = stdout;
|
f = stdout;
|
||||||
con_fprintf(f,clear_line_msg);
|
con_fprintf(f, "%s", clear_line_msg);
|
||||||
fflush(f);
|
fflush(f);
|
||||||
printSetNl(0);
|
printSetNl(0);
|
||||||
}
|
}
|
||||||
@@ -91,10 +91,10 @@ static void pr_error(const char *iname, const char *msg, bool is_warning)
|
|||||||
bool c = acc_isatty(STDERR_FILENO) ? 1 : 0;
|
bool c = acc_isatty(STDERR_FILENO) ? 1 : 0;
|
||||||
|
|
||||||
int fg = con_fg(stderr,FG_BRTRED);
|
int fg = con_fg(stderr,FG_BRTRED);
|
||||||
upx_snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),"%s: ", progname);
|
snprintf(buf+strlen(buf),sizeof(buf)-strlen(buf),"%s: ", progname);
|
||||||
pr_print(c,buf);
|
pr_print(c,buf);
|
||||||
//(void)con_fg(stderr,FG_RED);
|
//(void)con_fg(stderr,FG_RED);
|
||||||
upx_snprintf(buf,sizeof(buf),"%s: ", iname);
|
snprintf(buf,sizeof(buf),"%s: ", iname);
|
||||||
pr_print(c,buf);
|
pr_print(c,buf);
|
||||||
//(void)con_fg(stderr,FG_BRTRED);
|
//(void)con_fg(stderr,FG_BRTRED);
|
||||||
pr_print(c,msg);
|
pr_print(c,msg);
|
||||||
@@ -112,13 +112,13 @@ void printErr(const char *iname, const Throwable *e)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
upx_snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name()));
|
snprintf(buf, sizeof(buf), "%s", prettyName(typeid(*e).name()));
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
if (l < sizeof(buf) && e->getMsg())
|
if (l < sizeof(buf) && e->getMsg())
|
||||||
upx_snprintf(buf+l, sizeof(buf)-l, ": %s", e->getMsg());
|
snprintf(buf+l, sizeof(buf)-l, ": %s", e->getMsg());
|
||||||
l = strlen(buf);
|
l = strlen(buf);
|
||||||
if (l < sizeof(buf) && e->getErrno()) {
|
if (l < sizeof(buf) && e->getErrno()) {
|
||||||
upx_snprintf(buf+l, sizeof(buf)-l, ": %s", strerror(e->getErrno()));
|
snprintf(buf+l, sizeof(buf)-l, ": %s", strerror(e->getErrno()));
|
||||||
#if 1
|
#if 1
|
||||||
// some compilers (e.g. Borland C++) put a trailing '\n'
|
// some compilers (e.g. Borland C++) put a trailing '\n'
|
||||||
// into strerror() result
|
// into strerror() result
|
||||||
@@ -131,26 +131,26 @@ void printErr(const char *iname, const Throwable *e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
|
void printErr(const char *iname, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
upx_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
pr_error(iname,buf,false);
|
pr_error(iname,buf,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
|
void printWarn(const char *iname, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
upx_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
pr_error(iname,buf,true);
|
pr_error(iname,buf,true);
|
||||||
@@ -201,21 +201,21 @@ void infoHeader()
|
|||||||
info_header = 0;
|
info_header = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __acc_cdecl_va infoHeader(const char *format, ...)
|
void infoHeader(const char *format, ...)
|
||||||
{
|
{
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
upx_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info_print(buf);
|
info_print(buf);
|
||||||
info_header = 1;
|
info_header = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_va info(const char *format, ...)
|
void info(const char *format, ...)
|
||||||
{
|
{
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
return;
|
return;
|
||||||
@@ -224,13 +224,13 @@ void __acc_cdecl_va info(const char *format, ...)
|
|||||||
const int n = 4 * info_header;
|
const int n = 4 * info_header;
|
||||||
memset(buf, ' ', n);
|
memset(buf, ' ', n);
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
upx_vsnprintf(buf+n,sizeof(buf)-n,format,args);
|
upx_safe_vsnprintf(buf+n,sizeof(buf)-n,format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info_print(buf);
|
info_print(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void __acc_cdecl_va infoWarning(const char *format, ...)
|
void infoWarning(const char *format, ...)
|
||||||
{
|
{
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
{
|
{
|
||||||
@@ -240,7 +240,7 @@ void __acc_cdecl_va infoWarning(const char *format, ...)
|
|||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
upx_vsnprintf(buf,sizeof(buf),format,args);
|
upx_safe_vsnprintf(buf,sizeof(buf),format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
info("[WARNING] %s\n", buf);
|
info("[WARNING] %s\n", buf);
|
||||||
}
|
}
|
||||||
@@ -253,8 +253,4 @@ void infoWriting(const char *what, long size)
|
|||||||
info("Writing %s: %ld bytes", what, size);
|
info("Writing %s: %ld bytes", what, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* vim:set ts=4 sw=4 et: */
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,706 +0,0 @@
|
|||||||
/* Getopt for GNU.
|
|
||||||
NOTE: getopt is now part of the C library, so if you don't know what
|
|
||||||
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
|
|
||||||
before changing it!
|
|
||||||
|
|
||||||
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
|
|
||||||
Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by the
|
|
||||||
Free Software Foundation; either version 2, or (at your option) any
|
|
||||||
later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#undef PROGNAME
|
|
||||||
#if 0
|
|
||||||
#ifndef EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
#define PROGNAME(x) (x)
|
|
||||||
#else
|
|
||||||
#include "conf.h"
|
|
||||||
static const char *my_progname(const char *argv0)
|
|
||||||
{
|
|
||||||
return progname ? progname : argv0;
|
|
||||||
}
|
|
||||||
#define PROGNAME(x) my_progname(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
|
|
||||||
long-named option. Because this is not POSIX.2 compliant, it is
|
|
||||||
being phased out. */
|
|
||||||
/* #define GETOPT_COMPAT */
|
|
||||||
#undef GETOPT_COMPAT
|
|
||||||
|
|
||||||
/* This version of `getopt' appears to the caller like standard Unix `getopt'
|
|
||||||
but it behaves differently for the user, since it allows the user
|
|
||||||
to intersperse the options with the other arguments.
|
|
||||||
|
|
||||||
As `getopt' works, it permutes the elements of ARGV so that,
|
|
||||||
when it is done, all the options precede everything else. Thus
|
|
||||||
all application programs are extended to handle flexible argument order.
|
|
||||||
|
|
||||||
Setting the environment variable POSIXLY_CORRECT disables permutation.
|
|
||||||
Then the behavior is completely standard.
|
|
||||||
|
|
||||||
GNU application programs can use a third alternative mode in which
|
|
||||||
they can distinguish the relative order of options and other arguments. */
|
|
||||||
|
|
||||||
#include "mygetopt.h"
|
|
||||||
#define option mfx_option
|
|
||||||
#define optarg mfx_optarg
|
|
||||||
#define optind mfx_optind
|
|
||||||
#define opterr mfx_opterr
|
|
||||||
#define optopt mfx_optopt
|
|
||||||
#undef BAD_OPTION
|
|
||||||
|
|
||||||
/* For communication from `getopt' to the caller.
|
|
||||||
When `getopt' finds an option that takes an argument,
|
|
||||||
the argument value is returned here.
|
|
||||||
Also, when `ordering' is RETURN_IN_ORDER,
|
|
||||||
each non-option ARGV-element is returned here. */
|
|
||||||
|
|
||||||
char *optarg = NULL;
|
|
||||||
|
|
||||||
/* Index in ARGV of the next element to be scanned.
|
|
||||||
This is used for communication to and from the caller
|
|
||||||
and for communication between successive calls to `getopt'.
|
|
||||||
|
|
||||||
On entry to `getopt', zero means this is the first call; initialize.
|
|
||||||
|
|
||||||
When `getopt' returns EOF, this is the index of the first of the
|
|
||||||
non-option elements that the caller should itself scan.
|
|
||||||
|
|
||||||
Otherwise, `optind' communicates from one call to the next
|
|
||||||
how much of ARGV has been scanned so far. */
|
|
||||||
|
|
||||||
/* XXX 1003.2 says this must be 1 before any call. */
|
|
||||||
int optind = 0;
|
|
||||||
|
|
||||||
/* The next char to be scanned in the option-element
|
|
||||||
in which the last option character we returned was found.
|
|
||||||
This allows us to pick up the scan where we left off.
|
|
||||||
|
|
||||||
If this is zero, or a null string, it means resume the scan
|
|
||||||
by advancing to the next ARGV-element. */
|
|
||||||
|
|
||||||
static char *nextchar;
|
|
||||||
|
|
||||||
/* Callers store zero here to inhibit the error message
|
|
||||||
for unrecognized options. */
|
|
||||||
|
|
||||||
int opterr = 1;
|
|
||||||
|
|
||||||
/* Set to an option character which was unrecognized.
|
|
||||||
This must be initialized on some systems to avoid linking in the
|
|
||||||
system's own getopt implementation. */
|
|
||||||
|
|
||||||
#define BAD_OPTION '\0'
|
|
||||||
int optopt = BAD_OPTION;
|
|
||||||
|
|
||||||
/* Describe how to deal with options that follow non-option ARGV-elements.
|
|
||||||
|
|
||||||
If the caller did not specify anything,
|
|
||||||
the default is REQUIRE_ORDER if the environment variable
|
|
||||||
POSIXLY_CORRECT is defined, PERMUTE otherwise.
|
|
||||||
|
|
||||||
REQUIRE_ORDER means don't recognize them as options;
|
|
||||||
stop option processing when the first non-option is seen.
|
|
||||||
This is what Unix does.
|
|
||||||
This mode of operation is selected by either setting the environment
|
|
||||||
variable POSIXLY_CORRECT, or using `+' as the first character
|
|
||||||
of the list of option characters.
|
|
||||||
|
|
||||||
PERMUTE is the default. We permute the contents of ARGV as we scan,
|
|
||||||
so that eventually all the non-options are at the end. This allows options
|
|
||||||
to be given in any order, even with programs that were not written to
|
|
||||||
expect this.
|
|
||||||
|
|
||||||
RETURN_IN_ORDER is an option available to programs that were written
|
|
||||||
to expect options and other ARGV-elements in any order and that care about
|
|
||||||
the ordering of the two. We describe each non-option ARGV-element
|
|
||||||
as if it were the argument of an option with character code 1.
|
|
||||||
Using `-' as the first character of the list of option characters
|
|
||||||
selects this mode of operation.
|
|
||||||
|
|
||||||
The special argument `--' forces an end of option-scanning regardless
|
|
||||||
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
|
|
||||||
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
|
|
||||||
|
|
||||||
static enum
|
|
||||||
{
|
|
||||||
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
|
||||||
} ordering;
|
|
||||||
|
|
||||||
/* Handle permutation of arguments. */
|
|
||||||
|
|
||||||
/* Describe the part of ARGV that contains non-options that have
|
|
||||||
been skipped. `first_nonopt' is the index in ARGV of the first of them;
|
|
||||||
`last_nonopt' is the index after the last of them. */
|
|
||||||
|
|
||||||
static int first_nonopt;
|
|
||||||
static int last_nonopt;
|
|
||||||
|
|
||||||
/* Exchange two adjacent subsequences of ARGV.
|
|
||||||
One subsequence is elements [first_nonopt,last_nonopt)
|
|
||||||
which contains all the non-options that have been skipped so far.
|
|
||||||
The other is elements [last_nonopt,optind), which contains all
|
|
||||||
the options processed since those non-options were skipped.
|
|
||||||
|
|
||||||
`first_nonopt' and `last_nonopt' are relocated so that they describe
|
|
||||||
the new indices of the non-options in ARGV after they are moved.
|
|
||||||
|
|
||||||
To perform the swap, we first reverse the order of all elements. So
|
|
||||||
all options now come before all non options, but they are in the
|
|
||||||
wrong order. So we put back the options and non options in original
|
|
||||||
order by reversing them again. For example:
|
|
||||||
original input: a b c -x -y
|
|
||||||
reverse all: -y -x c b a
|
|
||||||
reverse options: -x -y c b a
|
|
||||||
reverse non options: -x -y a b c
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
static void exchange (char **argv)
|
|
||||||
{
|
|
||||||
char *temp; char **first, **last;
|
|
||||||
|
|
||||||
/* Reverse all the elements [first_nonopt, optind) */
|
|
||||||
first = &argv[first_nonopt];
|
|
||||||
last = &argv[optind-1];
|
|
||||||
while (first < last) {
|
|
||||||
temp = *first; *first = *last; *last = temp; first++; last--;
|
|
||||||
}
|
|
||||||
/* Put back the options in order */
|
|
||||||
first = &argv[first_nonopt];
|
|
||||||
first_nonopt += (optind - last_nonopt);
|
|
||||||
last = &argv[first_nonopt - 1];
|
|
||||||
while (first < last) {
|
|
||||||
temp = *first; *first = *last; *last = temp; first++; last--;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Put back the non options in order */
|
|
||||||
first = &argv[first_nonopt];
|
|
||||||
last_nonopt = optind;
|
|
||||||
last = &argv[last_nonopt-1];
|
|
||||||
while (first < last) {
|
|
||||||
temp = *first; *first = *last; *last = temp; first++; last--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scan elements of ARGV (whose length is ARGC) for option characters
|
|
||||||
given in OPTSTRING.
|
|
||||||
|
|
||||||
If an element of ARGV starts with '-', and is not exactly "-" or "--",
|
|
||||||
then it is an option element. The characters of this element
|
|
||||||
(aside from the initial '-') are option characters. If `getopt'
|
|
||||||
is called repeatedly, it returns successively each of the option characters
|
|
||||||
from each of the option elements.
|
|
||||||
|
|
||||||
If `getopt' finds another option character, it returns that character,
|
|
||||||
updating `optind' and `nextchar' so that the next call to `getopt' can
|
|
||||||
resume the scan with the following option character or ARGV-element.
|
|
||||||
|
|
||||||
If there are no more option characters, `getopt' returns `EOF'.
|
|
||||||
Then `optind' is the index in ARGV of the first ARGV-element
|
|
||||||
that is not an option. (The ARGV-elements have been permuted
|
|
||||||
so that those that are not options now come last.)
|
|
||||||
|
|
||||||
OPTSTRING is a string containing the legitimate option characters.
|
|
||||||
If an option character is seen that is not listed in OPTSTRING,
|
|
||||||
return BAD_OPTION after printing an error message. If you set `opterr' to
|
|
||||||
zero, the error message is suppressed but we still return BAD_OPTION.
|
|
||||||
|
|
||||||
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
|
|
||||||
so the following text in the same ARGV-element, or the text of the following
|
|
||||||
ARGV-element, is returned in `optarg'. Two colons mean an option that
|
|
||||||
wants an optional arg; if there is text in the current ARGV-element,
|
|
||||||
it is returned in `optarg', otherwise `optarg' is set to zero.
|
|
||||||
|
|
||||||
If OPTSTRING starts with `-' or `+', it requests different methods of
|
|
||||||
handling the non-option ARGV-elements.
|
|
||||||
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
|
|
||||||
|
|
||||||
Long-named options begin with `--' instead of `-'.
|
|
||||||
Their names may be abbreviated as long as the abbreviation is unique
|
|
||||||
or is an exact match for some defined option. If they have an
|
|
||||||
argument, it follows the option name in the same ARGV-element, separated
|
|
||||||
from the option name by a `=', or else the in next ARGV-element.
|
|
||||||
When `getopt' finds a long-named option, it returns 0 if that option's
|
|
||||||
`flag' field is nonzero, the value of the option's `val' field
|
|
||||||
if the `flag' field is zero.
|
|
||||||
|
|
||||||
LONGOPTS is a vector of `struct option' terminated by an
|
|
||||||
element containing a name which is zero.
|
|
||||||
|
|
||||||
LONGIND returns the index in LONGOPT of the long-named option found.
|
|
||||||
It is only valid when a long-named option has been found by the most
|
|
||||||
recent call.
|
|
||||||
|
|
||||||
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
|
|
||||||
long-named options. */
|
|
||||||
|
|
||||||
static int _getopt_internal (int argc, char **argv, const char *optstring,
|
|
||||||
const struct option *longopts, int *longind,
|
|
||||||
int long_only)
|
|
||||||
{
|
|
||||||
static char empty_string[1];
|
|
||||||
int option_index;
|
|
||||||
|
|
||||||
if (longind != NULL)
|
|
||||||
*longind = -1;
|
|
||||||
|
|
||||||
optarg = 0;
|
|
||||||
|
|
||||||
/* Initialize the internal data when the first call is made.
|
|
||||||
Start processing options with ARGV-element 1 (since ARGV-element 0
|
|
||||||
is the program name); the sequence of previously skipped
|
|
||||||
non-option ARGV-elements is empty. */
|
|
||||||
|
|
||||||
if (optind == 0)
|
|
||||||
{
|
|
||||||
first_nonopt = last_nonopt = optind = 1;
|
|
||||||
|
|
||||||
nextchar = NULL;
|
|
||||||
|
|
||||||
/* Determine how to handle the ordering of options and nonoptions. */
|
|
||||||
|
|
||||||
if (optstring[0] == '-')
|
|
||||||
{
|
|
||||||
ordering = RETURN_IN_ORDER;
|
|
||||||
++optstring;
|
|
||||||
}
|
|
||||||
else if (optstring[0] == '+')
|
|
||||||
{
|
|
||||||
ordering = REQUIRE_ORDER;
|
|
||||||
++optstring;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
else if (getenv ("POSIXLY_CORRECT") != NULL)
|
|
||||||
ordering = REQUIRE_ORDER;
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
ordering = PERMUTE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nextchar == NULL || *nextchar == '\0')
|
|
||||||
{
|
|
||||||
if (ordering == PERMUTE)
|
|
||||||
{
|
|
||||||
/* If we have just processed some options following some non-options,
|
|
||||||
exchange them so that the options come first. */
|
|
||||||
|
|
||||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
|
||||||
exchange (argv);
|
|
||||||
else if (last_nonopt != optind)
|
|
||||||
first_nonopt = optind;
|
|
||||||
|
|
||||||
/* Now skip any additional non-options
|
|
||||||
and extend the range of non-options previously skipped. */
|
|
||||||
|
|
||||||
while (optind < argc
|
|
||||||
&& (argv[optind][0] != '-' || argv[optind][1] == '\0')
|
|
||||||
#ifdef GETOPT_COMPAT
|
|
||||||
&& (longopts == NULL
|
|
||||||
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
|
|
||||||
#endif /* GETOPT_COMPAT */
|
|
||||||
)
|
|
||||||
optind++;
|
|
||||||
last_nonopt = optind;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Special ARGV-element `--' means premature end of options.
|
|
||||||
Skip it like a null option,
|
|
||||||
then exchange with previous non-options as if it were an option,
|
|
||||||
then skip everything else like a non-option. */
|
|
||||||
|
|
||||||
if (optind != argc && !strcmp (argv[optind], "--"))
|
|
||||||
{
|
|
||||||
optind++;
|
|
||||||
|
|
||||||
if (first_nonopt != last_nonopt && last_nonopt != optind)
|
|
||||||
exchange (argv);
|
|
||||||
else if (first_nonopt == last_nonopt)
|
|
||||||
first_nonopt = optind;
|
|
||||||
last_nonopt = argc;
|
|
||||||
|
|
||||||
optind = argc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have done all the ARGV-elements, stop the scan
|
|
||||||
and back over any non-options that we skipped and permuted. */
|
|
||||||
|
|
||||||
if (optind == argc)
|
|
||||||
{
|
|
||||||
/* Set the next-arg-index to point at the non-options
|
|
||||||
that we previously skipped, so the caller will digest them. */
|
|
||||||
if (first_nonopt != last_nonopt)
|
|
||||||
optind = first_nonopt;
|
|
||||||
return EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have come to a non-option and did not permute it,
|
|
||||||
either stop the scan or describe it to the caller and pass it by. */
|
|
||||||
|
|
||||||
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
|
|
||||||
#ifdef GETOPT_COMPAT
|
|
||||||
&& (longopts == NULL
|
|
||||||
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
|
|
||||||
#endif /* GETOPT_COMPAT */
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (ordering == REQUIRE_ORDER)
|
|
||||||
return EOF;
|
|
||||||
optarg = argv[optind++];
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We have found another option-ARGV-element.
|
|
||||||
Start decoding its characters. */
|
|
||||||
|
|
||||||
nextchar = (argv[optind] + 1
|
|
||||||
+ (longopts != NULL && argv[optind][1] == '-'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (longopts != NULL
|
|
||||||
&& ((argv[optind][0] == '-'
|
|
||||||
&& (argv[optind][1] == '-' || long_only))
|
|
||||||
#ifdef GETOPT_COMPAT
|
|
||||||
|| argv[optind][0] == '+'
|
|
||||||
#endif /* GETOPT_COMPAT */
|
|
||||||
))
|
|
||||||
{
|
|
||||||
const struct option *p;
|
|
||||||
char *s = nextchar;
|
|
||||||
int exact = 0;
|
|
||||||
int ambig = 0;
|
|
||||||
const struct option *pfound = NULL;
|
|
||||||
int indfound = 0;
|
|
||||||
int needexact = 0;
|
|
||||||
|
|
||||||
/* allow `--option#value' because you cannout assign a '='
|
|
||||||
to an environment variable under DOS command.com */
|
|
||||||
while (*s && *s != '=' && * s != '#')
|
|
||||||
s++;
|
|
||||||
|
|
||||||
/* Test all options for either exact match or abbreviated matches. */
|
|
||||||
for (p = longopts, option_index = 0; p->name;
|
|
||||||
p++, option_index++)
|
|
||||||
if (!strncmp (p->name, nextchar, (unsigned) (s - nextchar)))
|
|
||||||
{
|
|
||||||
if (p->has_arg & 0x10)
|
|
||||||
needexact = 1;
|
|
||||||
if ((unsigned) (s - nextchar) == strlen (p->name))
|
|
||||||
{
|
|
||||||
/* Exact match found. */
|
|
||||||
pfound = p;
|
|
||||||
indfound = option_index;
|
|
||||||
exact = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (pfound == NULL)
|
|
||||||
{
|
|
||||||
/* First nonexact match found. */
|
|
||||||
pfound = p;
|
|
||||||
indfound = option_index;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
/* Second nonexact match found. */
|
|
||||||
ambig = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* don't allow nonexact longoptions */
|
|
||||||
if (needexact && !exact)
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
fprintf (stderr, "%s: unrecognized option `%s'\n",
|
|
||||||
PROGNAME(argv[0]), argv[optind]);
|
|
||||||
nextchar += strlen (nextchar);
|
|
||||||
optind++;
|
|
||||||
return BAD_OPTION;
|
|
||||||
}
|
|
||||||
if (ambig && !exact)
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
fprintf (stderr, "%s: option `%s' is ambiguous\n",
|
|
||||||
PROGNAME(argv[0]), argv[optind]);
|
|
||||||
nextchar += strlen (nextchar);
|
|
||||||
optind++;
|
|
||||||
return BAD_OPTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pfound != NULL)
|
|
||||||
{
|
|
||||||
int have_arg = (s[0] != '\0');
|
|
||||||
if (have_arg && (pfound->has_arg & 0xf))
|
|
||||||
have_arg = (s[1] != '\0');
|
|
||||||
option_index = indfound;
|
|
||||||
optind++;
|
|
||||||
if (have_arg)
|
|
||||||
{
|
|
||||||
/* Don't test has_arg with >, because some C compilers don't
|
|
||||||
allow it to be used on enums. */
|
|
||||||
if (pfound->has_arg & 0xf)
|
|
||||||
optarg = s + 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
{
|
|
||||||
if (argv[optind - 1][1] == '-')
|
|
||||||
/* --option */
|
|
||||||
fprintf (stderr,
|
|
||||||
"%s: option `--%s' doesn't allow an argument\n",
|
|
||||||
PROGNAME(argv[0]), pfound->name);
|
|
||||||
else
|
|
||||||
/* +option or -option */
|
|
||||||
fprintf (stderr,
|
|
||||||
"%s: option `%c%s' doesn't allow an argument\n",
|
|
||||||
PROGNAME(argv[0]), argv[optind - 1][0], pfound->name);
|
|
||||||
}
|
|
||||||
nextchar += strlen (nextchar);
|
|
||||||
return BAD_OPTION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((pfound->has_arg & 0xf) == 1)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (optind < argc)
|
|
||||||
#else
|
|
||||||
if (optind < argc && (pfound->has_arg & 0x20) == 0)
|
|
||||||
#endif
|
|
||||||
optarg = argv[optind++];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
|
|
||||||
PROGNAME(argv[0]), pfound->name,
|
|
||||||
(pfound->has_arg & 0x20) ? "=" : "");
|
|
||||||
nextchar += strlen (nextchar);
|
|
||||||
return optstring[0] == ':' ? ':' : BAD_OPTION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nextchar += strlen (nextchar);
|
|
||||||
if (longind != NULL)
|
|
||||||
*longind = option_index;
|
|
||||||
if (pfound->flag)
|
|
||||||
{
|
|
||||||
*(pfound->flag) = pfound->val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return pfound->val;
|
|
||||||
}
|
|
||||||
/* Can't find it as a long option. If this is not getopt_long_only,
|
|
||||||
or the option starts with '--' or is not a valid short
|
|
||||||
option, then it's an error.
|
|
||||||
Otherwise interpret it as a short option. */
|
|
||||||
if (!long_only || argv[optind][1] == '-'
|
|
||||||
#ifdef GETOPT_COMPAT
|
|
||||||
|| argv[optind][0] == '+'
|
|
||||||
#endif /* GETOPT_COMPAT */
|
|
||||||
|| strchr (optstring, *nextchar) == NULL)
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
{
|
|
||||||
if (argv[optind][1] == '-')
|
|
||||||
/* --option */
|
|
||||||
fprintf (stderr, "%s: unrecognized option `--%s'\n",
|
|
||||||
PROGNAME(argv[0]), nextchar);
|
|
||||||
else
|
|
||||||
/* +option or -option */
|
|
||||||
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
|
|
||||||
PROGNAME(argv[0]), argv[optind][0], nextchar);
|
|
||||||
}
|
|
||||||
nextchar = empty_string;
|
|
||||||
optind++;
|
|
||||||
return BAD_OPTION;
|
|
||||||
}
|
|
||||||
(void) &ambig; /* UNUSED */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look at and handle the next option-character. */
|
|
||||||
|
|
||||||
{
|
|
||||||
char c = *nextchar++;
|
|
||||||
const char *temp = strchr (optstring, c);
|
|
||||||
|
|
||||||
/* Increment `optind' when we start to process its last character. */
|
|
||||||
if (*nextchar == '\0')
|
|
||||||
++optind;
|
|
||||||
|
|
||||||
if (temp == NULL || c == ':')
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if (c < 040 || c >= 0177)
|
|
||||||
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
|
|
||||||
PROGNAME(argv[0]), c);
|
|
||||||
else
|
|
||||||
fprintf (stderr, "%s: unrecognized option `-%c'\n", PROGNAME(argv[0]), c);
|
|
||||||
#else
|
|
||||||
/* 1003.2 specifies the format of this message. */
|
|
||||||
fprintf (stderr, "%s: illegal option -- %c\n", PROGNAME(argv[0]), c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
optopt = c;
|
|
||||||
return BAD_OPTION;
|
|
||||||
}
|
|
||||||
if (temp[1] == ':')
|
|
||||||
{
|
|
||||||
if (temp[2] == ':')
|
|
||||||
{
|
|
||||||
/* This is an option that accepts an argument optionally. */
|
|
||||||
if (*nextchar != '\0')
|
|
||||||
{
|
|
||||||
optarg = nextchar;
|
|
||||||
optind++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
optarg = 0;
|
|
||||||
nextchar = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* This is an option that requires an argument. */
|
|
||||||
if (*nextchar != '\0')
|
|
||||||
{
|
|
||||||
optarg = nextchar;
|
|
||||||
/* If we end this ARGV-element by taking the rest as an arg,
|
|
||||||
we must advance to the next element now. */
|
|
||||||
optind++;
|
|
||||||
}
|
|
||||||
else if (optind == argc)
|
|
||||||
{
|
|
||||||
if (opterr)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
fprintf (stderr, "%s: option `-%c' requires an argument\n",
|
|
||||||
PROGNAME(argv[0]), c);
|
|
||||||
#else
|
|
||||||
/* 1003.2 specifies the format of this message. */
|
|
||||||
fprintf (stderr, "%s: option requires an argument -- %c\n",
|
|
||||||
PROGNAME(argv[0]), c);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
optopt = c;
|
|
||||||
if (optstring[0] == ':')
|
|
||||||
c = ':';
|
|
||||||
else
|
|
||||||
c = BAD_OPTION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
/* We already incremented `optind' once;
|
|
||||||
increment it again when taking next ARGV-elt as argument. */
|
|
||||||
optarg = argv[optind++];
|
|
||||||
nextchar = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int mfx_getopt(int argc, char **argv, const char *optstring)
|
|
||||||
{
|
|
||||||
return _getopt_internal (argc, argv, optstring,
|
|
||||||
(const struct option *) 0,
|
|
||||||
(int *) 0,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int mfx_getopt_long(int argc, char **argv, const char *options,
|
|
||||||
const struct option *long_options, int *opt_index)
|
|
||||||
{
|
|
||||||
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef TEST
|
|
||||||
|
|
||||||
/* Compile with -DTEST to make an executable for use in testing
|
|
||||||
the above definition of `getopt'. */
|
|
||||||
|
|
||||||
int
|
|
||||||
main (argc, argv)
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
int digit_optind = 0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int this_option_optind = optind ? optind : 1;
|
|
||||||
|
|
||||||
c = getopt (argc, argv, "abc:d:0123456789");
|
|
||||||
if (c == EOF)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case '0':
|
|
||||||
case '1':
|
|
||||||
case '2':
|
|
||||||
case '3':
|
|
||||||
case '4':
|
|
||||||
case '5':
|
|
||||||
case '6':
|
|
||||||
case '7':
|
|
||||||
case '8':
|
|
||||||
case '9':
|
|
||||||
if (digit_optind != 0 && digit_optind != this_option_optind)
|
|
||||||
printf ("digits occur in two different argv-elements.\n");
|
|
||||||
digit_optind = this_option_optind;
|
|
||||||
printf ("option %c\n", c);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'a':
|
|
||||||
printf ("option a\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'b':
|
|
||||||
printf ("option b\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
|
||||||
printf ("option c with value `%s'\n", optarg);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BAD_OPTION:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf ("?? getopt returned character code 0%o ??\n", c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optind < argc)
|
|
||||||
{
|
|
||||||
printf ("non-option ARGV-elements: ");
|
|
||||||
while (optind < argc)
|
|
||||||
printf ("%s ", argv[optind++]);
|
|
||||||
printf ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
exit (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* TEST */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
vi:ts=4:et:nowrap
|
|
||||||
*/
|
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user