Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
cd8fd586
Commit
cd8fd586
authored
May 16, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
araw: filter out non-finite floating point samples
The input is not neessarily trusted. Better safe than sorry.
parent
eee1dd00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
modules/codec/Makefile.am
modules/codec/Makefile.am
+1
-0
modules/codec/araw.c
modules/codec/araw.c
+41
-0
No files found.
modules/codec/Makefile.am
View file @
cd8fd586
...
...
@@ -24,6 +24,7 @@ libaes3_plugin_la_SOURCES = codec/aes3.c
codec_LTLIBRARIES
+=
libaes3_plugin.la
libaraw_plugin_la_SOURCES
=
codec/araw.c
libaraw_plugin_la_LIBADD
=
$(LIBM)
codec_LTLIBRARIES
+=
libaraw_plugin.la
libdts_plugin_la_SOURCES
=
codec/dts.c codec/dts_header.c codec/dts_header.h
...
...
modules/codec/araw.c
View file @
cd8fd586
...
...
@@ -28,6 +28,7 @@
# include "config.h"
#endif
#include <math.h>
#include <assert.h>
#include <vlc_common.h>
...
...
@@ -96,7 +97,9 @@ static void S24L32Decode( void *, const uint8_t *, unsigned );
static
void
U32BDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
U32LDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
S32IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F32NDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F32IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F64NDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
F64IDecode
(
void
*
,
const
uint8_t
*
,
unsigned
);
static
void
DAT12Decode
(
void
*
,
const
uint8_t
*
,
unsigned
);
...
...
@@ -139,7 +142,10 @@ static int DecoderOpen( vlc_object_t *p_this )
#endif
format
=
VLC_CODEC_FL64
;
decode
=
F64IDecode
;
bits
=
64
;
break
;
case
VLC_CODEC_FL64
:
decode
=
F64NDecode
;
bits
=
64
;
break
;
#ifdef WORDS_BIGENDIAN
...
...
@@ -149,7 +155,10 @@ static int DecoderOpen( vlc_object_t *p_this )
#endif
format
=
VLC_CODEC_FL32
;
decode
=
F32IDecode
;
bits
=
32
;
break
;
case
VLC_CODEC_FL32
:
decode
=
F32NDecode
;
bits
=
32
;
break
;
case
VLC_CODEC_U32B
:
...
...
@@ -506,6 +515,20 @@ static void S32IDecode( void *outp, const uint8_t *in, unsigned samples )
}
}
static
void
F32NDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
float
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
memcpy
(
out
,
in
,
sizeof
(
float
)
);
if
(
unlikely
(
!
isfinite
(
*
out
))
)
*
out
=
0
.
f
;
out
++
;
in
+=
sizeof
(
float
);
}
}
static
void
F32IDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
float
*
out
=
outp
;
...
...
@@ -519,11 +542,27 @@ static void F32IDecode( void *outp, const uint8_t *in, unsigned samples )
#else
s
.
u
=
GetDWBE
(
in
);
#endif
if
(
unlikely
(
!
isfinite
(
s
.
f
))
)
s
.
f
=
0
.
f
;
*
(
out
++
)
=
s
.
f
;
in
+=
4
;
}
}
static
void
F64NDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
double
*
out
=
outp
;
for
(
size_t
i
=
0
;
i
<
samples
;
i
++
)
{
memcpy
(
out
,
in
,
sizeof
(
double
)
);
if
(
unlikely
(
!
isfinite
(
*
out
))
)
*
out
=
0
.;
out
++
;
in
+=
sizeof
(
double
);
}
}
static
void
F64IDecode
(
void
*
outp
,
const
uint8_t
*
in
,
unsigned
samples
)
{
double
*
out
=
outp
;
...
...
@@ -537,6 +576,8 @@ static void F64IDecode( void *outp, const uint8_t *in, unsigned samples )
#else
s
.
u
=
GetQWBE
(
in
);
#endif
if
(
unlikely
(
!
isfinite
(
s
.
d
))
)
s
.
d
=
0
.;
*
(
out
++
)
=
s
.
d
;
in
+=
8
;
}
...
...
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