Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e8519fec
Commit
e8519fec
authored
Mar 18, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge tag 'v0.19.14'
release v0.19.14
parents
06c17283
ff35aa07
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
NEWS
NEWS
+2
-1
TagPool.cxx
src/tag/TagPool.cxx
+11
-10
No files found.
NEWS
View file @
e8519fec
...
...
@@ -52,12 +52,13 @@ ver 0.20 (not yet released)
* update
- apply .mpdignore matches to subdirectories
ver 0.19.14 (
not yet released
)
ver 0.19.14 (
2016/03/18
)
* decoder
- dsdiff: fix off-by-one buffer overflow
- opus: limit tag size to 64 kB
* archive
- iso9660: fix buffer overflow
* fix quadratic runtime bug in the tag pool
* fix build failures on non-glibc builds due to constexpr Mutex
ver 0.19.13 (2016/02/23)
...
...
src/tag/TagPool.cxx
View file @
e8519fec
...
...
@@ -24,19 +24,23 @@
#include "util/VarSize.hxx"
#include "util/StringView.hxx"
#include <limits>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
Mutex
tag_pool_lock
;
static
constexpr
size_t
NUM_SLOTS
=
409
6
;
static
constexpr
size_t
NUM_SLOTS
=
409
3
;
struct
TagPoolSlot
{
TagPoolSlot
*
next
;
unsigned
char
ref
;
TagItem
item
;
static
constexpr
unsigned
MAX_REF
=
std
::
numeric_limits
<
decltype
(
ref
)
>::
max
();
TagPoolSlot
(
TagPoolSlot
*
_next
,
TagType
type
,
StringView
value
)
:
next
(
_next
),
ref
(
1
)
{
...
...
@@ -114,7 +118,7 @@ tag_pool_get_item(TagType type, StringView value)
for
(
auto
slot
=
*
slot_p
;
slot
!=
nullptr
;
slot
=
slot
->
next
)
{
if
(
slot
->
item
.
type
==
type
&&
value
.
Equals
(
slot
->
item
.
value
)
&&
slot
->
ref
<
0xff
)
{
slot
->
ref
<
TagPoolSlot
::
MAX_REF
)
{
assert
(
slot
->
ref
>
0
);
++
slot
->
ref
;
return
&
slot
->
item
;
...
...
@@ -133,17 +137,14 @@ tag_pool_dup_item(TagItem *item)
assert
(
slot
->
ref
>
0
);
if
(
slot
->
ref
<
0xff
)
{
if
(
slot
->
ref
<
TagPoolSlot
::
MAX_REF
)
{
++
slot
->
ref
;
return
item
;
}
else
{
/* the reference counter overflows above 0xff;
duplicate the item, and start with 1 */
auto
slot_p
=
tag_value_slot_p
(
item
->
type
,
item
->
value
);
slot
=
TagPoolSlot
::
Create
(
*
slot_p
,
item
->
type
,
item
->
value
);
*
slot_p
=
slot
;
return
&
slot
->
item
;
/* the reference counter overflows above MAX_REF;
obtain a reference to a different TagPoolSlot which
isn't yet "full" */
return
tag_pool_get_item
(
item
->
type
,
item
->
value
);
}
}
...
...
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