소스 검색

Prevent a divide-by-zero by checking for a zero width or height.

pull/66/head
Josef Moellers 2 년 전
부모
커밋
d33a9ca2b7
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. +8
    -2
      src/img2txt.c

+ 8
- 2
src/img2txt.c 파일 보기

@@ -177,7 +177,13 @@ int main(int argc, char **argv)
}

/* Assume a 6×10 font */
if(!cols && !lines)
if(!i->w || !i->h)
{
fprintf(stderr, "%s: image size is 0\n", argv[0]);
lines = 0;
cols = 0;
}
else if(!cols && !lines)
{
cols = 60;
lines = cols * i->h * font_width / i->w / font_height;
@@ -214,7 +220,7 @@ int main(int argc, char **argv)
export = caca_export_canvas_to_memory(cv, format?format:"ansi", &len);
if(!export)
{
fprintf(stderr, "%s: Can't export to format '%s'\n", argv[0], format);
fprintf(stderr, "%s: Can't export to format '%s'\n", argv[0], format?format:"ansi");
}
else
{


불러오는 중...
취소
저장