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
52943ce6
Commit
52943ce6
authored
Jan 10, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check plugins directory names for unsupported capability
parent
417eadba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
1 deletion
+46
-1
src/libvlc.h
src/libvlc.h
+1
-0
src/misc/cpu.c
src/misc/cpu.c
+42
-0
src/modules/modules.c
src/modules/modules.c
+3
-1
No files found.
src/libvlc.h
View file @
52943ce6
...
...
@@ -79,6 +79,7 @@ void vlc_assert_locked (vlc_mutex_t *);
*/
extern
uint32_t
cpu_flags
;
uint32_t
CPUCapabilities
(
void
);
bool
vlc_CPU_CheckPluginDir
(
const
char
*
name
);
/*
* Message/logging stuff
...
...
src/misc/cpu.c
View file @
52943ce6
...
...
@@ -296,6 +296,48 @@ unsigned vlc_CPU (void)
return
cpu_flags
;
}
const
struct
{
uint32_t
value
;
char
name
[
12
];
}
cap_dirs
[]
=
{
#if defined ( __i386__ ) || defined ( __x86_64__ )
{
CPU_CAPABILITY_MMX
,
"mmx"
},
{
CPU_CAPABILITY_MMXEXT
,
"mmxext"
},
{
CPU_CAPABILITY_3DNOW
,
"3dnow"
},
{
CPU_CAPABILITY_SSE
,
"sse"
},
#endif
#if defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
{
CPU_CAPABILITY_ALTIVEC
,
"altivec"
},
#endif
#if defined (__arm__)
{
CPU_CAPABILITY_NEON
,
"arm_neon"
},
#endif
};
/**
* Check if a directory name contains usable plugins w.r.t. the hardware
* capabilities. Loading a plugin when the hardware has insufficient
* capabilities may lead to illegal instructions (SIGILL) and must be avoided.
*
* @param name the name of the directory (<b>not</b> the path)
*
* @return true if the hardware has sufficient capabilities or the directory
* does not require any special capability; false if the running hardware has
* insufficient capabilities.
*/
bool
vlc_CPU_CheckPluginDir
(
const
char
*
name
)
{
const
unsigned
flags
=
vlc_CPU
();
for
(
size_t
i
=
0
;
i
<
sizeof
(
cap_dirs
)
/
sizeof
(
cap_dirs
[
0
]);
i
++
)
{
if
(
strcmp
(
name
,
cap_dirs
[
i
].
name
))
continue
;
return
(
flags
&
cap_dirs
[
i
].
value
)
!=
0
;
}
return
true
;
}
static
vlc_memcpy_t
pf_vlc_memcpy
=
memcpy
;
static
vlc_memset_t
pf_vlc_memset
=
memset
;
...
...
src/modules/modules.c
View file @
52943ce6
...
...
@@ -906,7 +906,9 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
break
;
/* Skip ".", ".." */
if
(
!
strcmp
(
file
,
"."
)
||
!
strcmp
(
file
,
".."
))
if
(
!
strcmp
(
file
,
"."
)
||
!
strcmp
(
file
,
".."
)
/* Skip directories for unsupported optimizations */
||
!
vlc_CPU_CheckPluginDir
(
file
))
{
free
(
file
);
continue
;
...
...
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