Re: Where to find examples of malformed JPEG files
- From: blr@xxxxxxxxxxx (Brian Raiter)
- Date: Tue, 23 Aug 2005 20:00:01 +0000 (UTC)
> I guess you could create it yourself, maybe by trying to store a
> JPEG to a floppy disk and yanking it during the save.
That's a bit hit-or-miss. You can easily truncate a file by using
wc(1) if you're on a Unix system:
wc -c500 foo.jpg > broken.jpg
or by using Perl just about anywhere.
perl -e 'truncate "foo.jpg", 500'
For that matter, a GIF file makes a great corrupted JPEG file. Or just
about any other kind of file. It depends on what kind of corruption
you're looking for.
Try opening a JPEG file in a text editor. Saving it back out again
might be enough to corrupt it, depending on your OS and your
editor. If not, then just move the cursor a ways down and add or
delete a single character.
Here's another Perl script:
perl -e 'open F, shift; seek F, 500, 0; print F chr 255' foo.jpg
This replaces the 500th byte in the file foo.jpg with the value 255.
Replace 500 and 255 with anything you like to tailor the corruption
to taste.
b
.
- Follow-Ups:
- Re: Where to find examples of malformed JPEG files
- From: Carsten Neubauer
- Re: Where to find examples of malformed JPEG files
- References:
- Where to find examples of malformed JPEG files
- From: Allen . Todd
- Re: Where to find examples of malformed JPEG files
- From: matt512
- Where to find examples of malformed JPEG files
- Prev by Date: Re: Where to find examples of malformed JPEG files
- Next by Date: Q: "phase in coding" what is it?
- Previous by thread: Re: Where to find examples of malformed JPEG files
- Next by thread: Re: Where to find examples of malformed JPEG files
- Index(es):
Relevant Pages
|