Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
magic-lantern
magic-lantern
Commits
d4912ccadeb9
Commit
e5f4af2e
authored
Mar 13, 2015
by
a1ex
Browse files
mlv_play: refuse to play corrupted files
--HG-- branch : unified
parent
de733cadaf70
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/mlv_play/mlv_play.c
View file @
d4912cca
...
...
@@ -1076,8 +1076,8 @@ static void mlv_play_build_index(char *filename, FILE **chunk_files, uint32_t ch
{
bmp_printf
(
FONT_MED
,
30
,
190
,
"File #%d ends prematurely, %d bytes read"
,
chunk
,
read
);
beep
();
msleep
(
1
000
);
b
re
ak
;
msleep
(
2
000
);
re
turn
;
}
}
...
...
@@ -1086,8 +1086,8 @@ static void mlv_play_build_index(char *filename, FILE **chunk_files, uint32_t ch
{
bmp_printf
(
FONT_MED
,
30
,
190
,
"Invalid header size: %d bytes at 0x%08X"
,
buf
.
blockSize
,
position
);
beep
();
msleep
(
1
000
);
b
re
ak
;
msleep
(
2
000
);
re
turn
;
}
/* file header */
...
...
@@ -1103,8 +1103,8 @@ static void mlv_play_build_index(char *filename, FILE **chunk_files, uint32_t ch
{
bmp_printf
(
FONT_MED
,
30
,
190
,
"File ends prematurely during MLVI"
);
beep
();
msleep
(
1
000
);
b
re
ak
;
msleep
(
2
000
);
re
turn
;
}
/* is this the first file? */
...
...
@@ -1119,8 +1119,8 @@ static void mlv_play_build_index(char *filename, FILE **chunk_files, uint32_t ch
{
bmp_printf
(
FONT_MED
,
30
,
190
,
"Error: GUID within the file chunks mismatch!"
);
beep
();
msleep
(
1
000
);
b
re
ak
;
msleep
(
2
000
);
re
turn
;
}
}
...
...
@@ -1579,6 +1579,13 @@ static void mlv_play_mlv(char *filename, FILE **chunk_files, uint32_t chunk_coun
/* load or create index file */
block_xref
=
mlv_play_get_index
(
filename
,
chunk_files
,
chunk_count
);
if
(
!
block_xref
)
{
bmp_printf
(
FONT_LARGE
,
30
,
100
,
"Index error:"
,
filename
);
bmp_printf
(
FONT_MED
,
40
,
100
+
font_large
.
height
+
1
,
filename
);
return
;
}
mlv_xref_t
*
xrefs
=
(
mlv_xref_t
*
)
&
(((
uint8_t
*
)
block_xref
)[
sizeof
(
mlv_xref_hdr_t
)]);
/* index building would print on screen */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment