alef78 / lzoma

experimental data compression algoritm
GNU General Public License v2.0
21 stars 1 forks source link

SIGSEGV if running encoder without parameters. #4

Closed xcrh closed 8 years ago

xcrh commented 8 years ago

Troublesome code is in pack.c, line 936

  if (argc<3) {
    printf("usage: lzoma input output [lzlit lit olz len dist]\n");
    int i;
    int total=atoi(argv[1]);//16*1024*1024; <- here it going to crash.

Crash happens because if you run program without any params at all, only argv[0] is available (proram name) but you're trying to access argv[1], which may or may not exist.

alef78 commented 8 years ago

Fixed.