Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What happen when I just input a file with ONE picture? #1

Open
frokaikan opened this issue Jul 17, 2018 · 6 comments
Open

What happen when I just input a file with ONE picture? #1

frokaikan opened this issue Jul 17, 2018 · 6 comments

Comments

@frokaikan
Copy link

root@xxx:/opt/imgify# ./bin2png -i other/ -o png_out/out.png
open: Bad address

=================================================================
==30313==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x436e10 in __interceptor_strdup (/opt/imgify/bin2png+0x436e10)
#1 0x512eab in parse_options /opt/imgify/./common_options.h:59:23
#2 0x512eab in main /opt/imgify/./common_main.h:10
#3 0x7fd473275b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

Direct leak of 7 byte(s) in 1 object(s) allocated from:
#0 0x436e10 in __interceptor_strdup (/opt/imgify/bin2png+0x436e10)
#1 0x512de9 in parse_options /opt/imgify/./common_options.h:56:22
#2 0x512de9 in main /opt/imgify/./common_main.h:10
#3 0x7fd473275b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

SUMMARY: AddressSanitizer: 23 byte(s) leaked in 2 allocation(s).

other is just a directory with ONE .bmp file
other.zip

@jweyrich
Copy link
Owner

jweyrich commented Jul 17, 2018

Hi! Thanks for the report! :-)
The input argument (-i) accepts a single file, and that's why open fails with Bad address, since it couldn't access the file you informed. In the sample you provided, it seems that you're informing the path to a folder. Is that right? If so, reading all files from a directory is currently not supported, but it's a feature that I could consider if you can explain me your use case. As a side note, currently, the tool only converts the raw contents of files (binary, spreadsheets, text, whatever) to PNG and from PNG.
Does that make sense?

@frokaikan
Copy link
Author

But I also tried to pass the file to bin2png like this:
root@xxx:/opt/imgify# ./bin2png -i other/not_kitty.bmp -o png_out/out.png
open: Bad address

=================================================================
==30677==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 20 byte(s) in 1 object(s) allocated from:
#0 0x436e10 in __interceptor_strdup (/opt/imgify/bin2png+0x436e10)
#1 0x512de9 in parse_options /opt/imgify/./common_options.h:56:22
#2 0x512de9 in main /opt/imgify/./common_main.h:10
#3 0x7ff9a5595b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x436e10 in __interceptor_strdup (/opt/imgify/bin2png+0x436e10)
#1 0x512eab in parse_options /opt/imgify/./common_options.h:59:23
#2 0x512eab in main /opt/imgify/./common_main.h:10
#3 0x7ff9a5595b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

SUMMARY: AddressSanitizer: 36 byte(s) leaked in 2 allocation(s).

It also tells me that I got a bad address.

@jweyrich
Copy link
Owner

jweyrich commented Jul 18, 2018

Good news: I believe I managed to get rid of those memory leak warnings.

Bad news: I couldn't reproduce the issue you described. I tried with various files, including the BMP sample you provided.

screen shot 2018-07-18 at 19 17 11

@frokaikan
Copy link
Author

But I got this...
image

@jweyrich
Copy link
Owner

jweyrich commented Aug 2, 2018

  1. Which Linux distribution are you running?
  2. Which filesystem it's using?
  3. Do you have any FS mount-points related to /opt? In other words, are you mounting /opt (or anything contained in it) from somewhere else?

Looks like the stat syscall is returning EFAULT instead of ENOENT - which is weird.

@frokaikan
Copy link
Author

I use Ubuntu 16 (with Oracla VM VirtualBox, built on Windows 10) and /opt is NOT a mount-point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants