style(scanner): tagged switch on ID3 major version — #2499
This commit is contained in:
@@ -141,10 +141,10 @@ func findGenreFrame(body []byte, major byte) ([]string, error) {
|
|||||||
// the reverse) yields a plausible-looking wrong offset rather than an obvious
|
// the reverse) yields a plausible-looking wrong offset rather than an obvious
|
||||||
// error, which is exactly how frame-walking bugs go unnoticed.
|
// error, which is exactly how frame-walking bugs go unnoticed.
|
||||||
func frameSize(b []byte, major byte) int {
|
func frameSize(b []byte, major byte) int {
|
||||||
switch {
|
switch major {
|
||||||
case major == 2:
|
case 2:
|
||||||
return int(b[0])<<16 | int(b[1])<<8 | int(b[2])
|
return int(b[0])<<16 | int(b[1])<<8 | int(b[2])
|
||||||
case major == 3:
|
case 3:
|
||||||
n := binary.BigEndian.Uint32(b)
|
n := binary.BigEndian.Uint32(b)
|
||||||
if n > maxID3TagSize {
|
if n > maxID3TagSize {
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
Reference in New Issue
Block a user