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
adffbba2
Commit
adffbba2
authored
Jun 05, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge tag 'v0.21.10'
release v0.21.10
parents
120e570d
e2390092
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
21 deletions
+57
-21
NEWS
NEWS
+5
-1
OpusReader.hxx
src/decoder/plugins/OpusReader.hxx
+6
-6
OpusTags.cxx
src/decoder/plugins/OpusTags.cxx
+17
-8
HttpdClient.cxx
src/output/plugins/httpd/HttpdClient.cxx
+24
-6
HttpdClient.hxx
src/output/plugins/httpd/HttpdClient.hxx
+5
-0
No files found.
NEWS
View file @
adffbba2
...
@@ -12,7 +12,11 @@ ver 0.22 (not yet released)
...
@@ -12,7 +12,11 @@ ver 0.22 (not yet released)
- ffmpeg: new plugin based on FFmpeg's libavfilter library
- ffmpeg: new plugin based on FFmpeg's libavfilter library
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
ver 0.21.10 (not yet released)
ver 0.21.10 (2019/06/05)
* decoder
- opus: fix duplicate tags
* output
- httpd: reject some well-known URIs
* fix crash bug (0.21.9 regression)
* fix crash bug (0.21.9 regression)
ver 0.21.9 (2019/05/20)
ver 0.21.9 (2019/05/20)
...
...
src/decoder/plugins/OpusReader.hxx
View file @
adffbba2
/*
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
* http://www.musicpd.org
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#ifndef MPD_OPUS_READER_HXX
#ifndef MPD_OPUS_READER_HXX
#define MPD_OPUS_READER_HXX
#define MPD_OPUS_READER_HXX
#include "util/StringView.hxx"
#include <algorithm>
#include <algorithm>
#include <stdint.h>
#include <stdint.h>
...
@@ -81,18 +83,16 @@ public:
...
@@ -81,18 +83,16 @@ public:
return
ReadWord
(
length
)
&&
Skip
(
length
);
return
ReadWord
(
length
)
&&
Skip
(
length
);
}
}
char
*
ReadString
()
{
StringView
ReadString
()
{
uint32_t
length
;
uint32_t
length
;
if
(
!
ReadWord
(
length
)
||
length
>=
65536
)
if
(
!
ReadWord
(
length
))
return
nullptr
;
return
nullptr
;
const
char
*
src
=
(
const
char
*
)
Read
(
length
);
const
char
*
src
=
(
const
char
*
)
Read
(
length
);
if
(
src
==
nullptr
)
if
(
src
==
nullptr
)
return
nullptr
;
return
nullptr
;
char
*
dest
=
new
char
[
length
+
1
];
return
{
src
,
length
};
*
std
::
copy_n
(
src
,
length
,
dest
)
=
0
;
return
dest
;
}
}
};
};
...
...
src/decoder/plugins/OpusTags.cxx
View file @
adffbba2
...
@@ -24,6 +24,8 @@
...
@@ -24,6 +24,8 @@
#include "tag/ParseName.hxx"
#include "tag/ParseName.hxx"
#include "ReplayGainInfo.hxx"
#include "ReplayGainInfo.hxx"
#include <string>
#include <stdint.h>
#include <stdint.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -91,18 +93,25 @@ ScanOpusTags(const void *data, size_t size,
...
@@ -91,18 +93,25 @@ ScanOpusTags(const void *data, size_t size,
return
false
;
return
false
;
while
(
n
--
>
0
)
{
while
(
n
--
>
0
)
{
c
har
*
p
=
r
.
ReadString
();
c
onst
auto
s
=
r
.
ReadString
();
if
(
p
==
nullptr
)
if
(
s
==
nullptr
)
return
false
;
return
false
;
char
*
eq
=
strchr
(
p
,
'='
);
if
(
s
.
size
>=
4096
)
if
(
eq
!=
nullptr
&&
eq
>
p
)
{
continue
;
*
eq
=
0
;
const
auto
eq
=
s
.
Find
(
'='
);
if
(
eq
==
nullptr
||
eq
==
s
.
data
)
continue
;
auto
name
=
s
,
value
=
s
;
name
.
SetEnd
(
eq
);
value
.
MoveFront
(
eq
+
1
);
ScanOneOpusTag
(
p
,
eq
+
1
,
rgi
,
handler
);
const
std
::
string
name2
(
name
.
data
,
name
.
size
);
}
const
std
::
string
value2
(
value
.
data
,
value
.
size
);
delete
[]
p
;
ScanOneOpusTag
(
name2
.
c_str
(),
value2
.
c_str
(),
rgi
,
handler
)
;
}
}
return
true
;
return
true
;
...
...
src/output/plugins/httpd/HttpdClient.cxx
View file @
adffbba2
...
@@ -71,10 +71,10 @@ HttpdClient::HandleLine(const char *line) noexcept
...
@@ -71,10 +71,10 @@ HttpdClient::HandleLine(const char *line) noexcept
assert
(
state
!=
State
::
RESPONSE
);
assert
(
state
!=
State
::
RESPONSE
);
if
(
state
==
State
::
REQUEST
)
{
if
(
state
==
State
::
REQUEST
)
{
if
(
mem
cmp
(
line
,
"HEAD /"
,
6
)
==
0
)
{
if
(
strn
cmp
(
line
,
"HEAD /"
,
6
)
==
0
)
{
line
+=
6
;
line
+=
6
;
head_method
=
true
;
head_method
=
true
;
}
else
if
(
mem
cmp
(
line
,
"GET /"
,
5
)
==
0
)
{
}
else
if
(
strn
cmp
(
line
,
"GET /"
,
5
)
==
0
)
{
line
+=
5
;
line
+=
5
;
}
else
{
}
else
{
/* only GET is supported */
/* only GET is supported */
...
@@ -83,8 +83,19 @@ HttpdClient::HandleLine(const char *line) noexcept
...
@@ -83,8 +83,19 @@ HttpdClient::HandleLine(const char *line) noexcept
return
false
;
return
false
;
}
}
/* blacklist some well-known request paths */
if
((
strncmp
(
line
,
"favicon.ico"
,
11
)
==
0
&&
(
line
[
11
]
==
'\0'
||
line
[
11
]
==
' '
))
||
(
strncmp
(
line
,
"robots.txt"
,
10
)
==
0
&&
(
line
[
10
]
==
'\0'
||
line
[
10
]
==
' '
))
||
(
strncmp
(
line
,
"sitemap.xml"
,
11
)
==
0
&&
(
line
[
11
]
==
'\0'
||
line
[
11
]
==
' '
))
||
(
strncmp
(
line
,
".well-known/"
,
12
)
==
0
))
{
should_reject
=
true
;
}
line
=
strchr
(
line
,
' '
);
line
=
strchr
(
line
,
' '
);
if
(
line
==
nullptr
||
mem
cmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
if
(
line
==
nullptr
||
strn
cmp
(
line
+
1
,
"HTTP/"
,
5
)
!=
0
)
{
/* HTTP/0.9 without request headers */
/* HTTP/0.9 without request headers */
if
(
head_method
)
if
(
head_method
)
...
@@ -129,14 +140,21 @@ HttpdClient::SendResponse() noexcept
...
@@ -129,14 +140,21 @@ HttpdClient::SendResponse() noexcept
assert
(
state
==
State
::
RESPONSE
);
assert
(
state
==
State
::
RESPONSE
);
if
(
metadata_requested
)
{
if
(
should_reject
)
{
response
=
"HTTP/1.1 404 not found
\r\n
"
"Content-Type: text/plain
\r\n
"
"Connection: close
\r\n
"
"
\r\n
"
"404 not found"
;
}
else
if
(
metadata_requested
)
{
allocated
=
allocated
=
icy_server_metadata_header
(
httpd
.
name
,
httpd
.
genre
,
icy_server_metadata_header
(
httpd
.
name
,
httpd
.
genre
,
httpd
.
website
,
httpd
.
website
,
httpd
.
content_type
,
httpd
.
content_type
,
metaint
);
metaint
);
response
=
allocated
.
c_str
();
response
=
allocated
.
c_str
();
}
else
{
/* revert to a normal HTTP request */
}
else
{
/* revert to a normal HTTP request */
snprintf
(
buffer
,
sizeof
(
buffer
),
snprintf
(
buffer
,
sizeof
(
buffer
),
"HTTP/1.1 200 OK
\r\n
"
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: %s
\r\n
"
"Content-Type: %s
\r\n
"
...
@@ -415,7 +433,7 @@ HttpdClient::OnSocketInput(void *data, size_t length) noexcept
...
@@ -415,7 +433,7 @@ HttpdClient::OnSocketInput(void *data, size_t length) noexcept
if
(
!
SendResponse
())
if
(
!
SendResponse
())
return
InputResult
::
CLOSED
;
return
InputResult
::
CLOSED
;
if
(
head_method
)
{
if
(
head_method
||
should_reject
)
{
LockClose
();
LockClose
();
return
InputResult
::
CLOSED
;
return
InputResult
::
CLOSED
;
}
}
...
...
src/output/plugins/httpd/HttpdClient.hxx
View file @
adffbba2
...
@@ -83,6 +83,11 @@ class HttpdClient final
...
@@ -83,6 +83,11 @@ class HttpdClient final
*/
*/
bool
head_method
=
false
;
bool
head_method
=
false
;
/**
* Should we reject this request?
*/
bool
should_reject
=
false
;
/* ICY */
/* ICY */
/**
/**
...
...
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