mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore]: Bump golang.org/x/image from 0.9.0 to 0.11.0 (#2074)
This commit is contained in:
14
vendor/golang.org/x/image/bmp/reader.go
generated
vendored
14
vendor/golang.org/x/image/bmp/reader.go
generated
vendored
@ -191,14 +191,22 @@ func decodeConfig(r io.Reader) (config image.Config, bitsPerPixel int, topDown b
|
||||
}
|
||||
switch bpp {
|
||||
case 8:
|
||||
if offset != fileHeaderLen+infoLen+256*4 {
|
||||
colorUsed := readUint32(b[46:50])
|
||||
// If colorUsed is 0, it is set to the maximum number of colors for the given bpp, which is 2^bpp.
|
||||
if colorUsed == 0 {
|
||||
colorUsed = 256
|
||||
} else if colorUsed > 256 {
|
||||
return image.Config{}, 0, false, false, ErrUnsupported
|
||||
}
|
||||
_, err = io.ReadFull(r, b[:256*4])
|
||||
|
||||
if offset != fileHeaderLen+infoLen+colorUsed*4 {
|
||||
return image.Config{}, 0, false, false, ErrUnsupported
|
||||
}
|
||||
_, err = io.ReadFull(r, b[:colorUsed*4])
|
||||
if err != nil {
|
||||
return image.Config{}, 0, false, false, err
|
||||
}
|
||||
pcm := make(color.Palette, 256)
|
||||
pcm := make(color.Palette, colorUsed)
|
||||
for i := range pcm {
|
||||
// BMP images are stored in BGR order rather than RGB order.
|
||||
// Every 4th byte is padding.
|
||||
|
33
vendor/golang.org/x/image/tiff/reader.go
generated
vendored
33
vendor/golang.org/x/image/tiff/reader.go
generated
vendored
@ -8,13 +8,13 @@
|
||||
package tiff // import "golang.org/x/image/tiff"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/zlib"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
|
||||
"golang.org/x/image/ccitt"
|
||||
@ -579,6 +579,11 @@ func newDecoder(r io.Reader) (*decoder, error) {
|
||||
default:
|
||||
return nil, UnsupportedError("color model")
|
||||
}
|
||||
if d.firstVal(tPhotometricInterpretation) != pRGB {
|
||||
if len(d.features[tBitsPerSample]) != 1 {
|
||||
return nil, UnsupportedError("extra samples")
|
||||
}
|
||||
}
|
||||
|
||||
return d, nil
|
||||
}
|
||||
@ -629,6 +634,13 @@ func Decode(r io.Reader) (img image.Image, err error) {
|
||||
blockWidth = int(d.firstVal(tTileWidth))
|
||||
blockHeight = int(d.firstVal(tTileLength))
|
||||
|
||||
// The specification says that tile widths and lengths must be a multiple of 16.
|
||||
// We currently permit invalid sizes, but reject anything too small to limit the
|
||||
// amount of work a malicious input can force us to perform.
|
||||
if blockWidth < 8 || blockHeight < 8 {
|
||||
return nil, FormatError("tile size is too small")
|
||||
}
|
||||
|
||||
if blockWidth != 0 {
|
||||
blocksAcross = (d.config.Width + blockWidth - 1) / blockWidth
|
||||
}
|
||||
@ -681,6 +693,11 @@ func Decode(r io.Reader) (img image.Image, err error) {
|
||||
}
|
||||
}
|
||||
|
||||
if blocksAcross == 0 || blocksDown == 0 {
|
||||
return
|
||||
}
|
||||
// Maximum data per pixel is 8 bytes (RGBA64).
|
||||
blockMaxDataSize := int64(blockWidth) * int64(blockHeight) * 8
|
||||
for i := 0; i < blocksAcross; i++ {
|
||||
blkW := blockWidth
|
||||
if !blockPadding && i == blocksAcross-1 && d.config.Width%blockWidth != 0 {
|
||||
@ -708,15 +725,15 @@ func Decode(r io.Reader) (img image.Image, err error) {
|
||||
inv := d.firstVal(tPhotometricInterpretation) == pWhiteIsZero
|
||||
order := ccittFillOrder(d.firstVal(tFillOrder))
|
||||
r := ccitt.NewReader(io.NewSectionReader(d.r, offset, n), order, ccitt.Group3, blkW, blkH, &ccitt.Options{Invert: inv, Align: false})
|
||||
d.buf, err = ioutil.ReadAll(r)
|
||||
d.buf, err = readBuf(r, d.buf, blockMaxDataSize)
|
||||
case cG4:
|
||||
inv := d.firstVal(tPhotometricInterpretation) == pWhiteIsZero
|
||||
order := ccittFillOrder(d.firstVal(tFillOrder))
|
||||
r := ccitt.NewReader(io.NewSectionReader(d.r, offset, n), order, ccitt.Group4, blkW, blkH, &ccitt.Options{Invert: inv, Align: false})
|
||||
d.buf, err = ioutil.ReadAll(r)
|
||||
d.buf, err = readBuf(r, d.buf, blockMaxDataSize)
|
||||
case cLZW:
|
||||
r := lzw.NewReader(io.NewSectionReader(d.r, offset, n), lzw.MSB, 8)
|
||||
d.buf, err = ioutil.ReadAll(r)
|
||||
d.buf, err = readBuf(r, d.buf, blockMaxDataSize)
|
||||
r.Close()
|
||||
case cDeflate, cDeflateOld:
|
||||
var r io.ReadCloser
|
||||
@ -724,7 +741,7 @@ func Decode(r io.Reader) (img image.Image, err error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
d.buf, err = ioutil.ReadAll(r)
|
||||
d.buf, err = readBuf(r, d.buf, blockMaxDataSize)
|
||||
r.Close()
|
||||
case cPackBits:
|
||||
d.buf, err = unpackBits(io.NewSectionReader(d.r, offset, n))
|
||||
@ -748,6 +765,12 @@ func Decode(r io.Reader) (img image.Image, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func readBuf(r io.Reader, buf []byte, lim int64) ([]byte, error) {
|
||||
b := bytes.NewBuffer(buf[:0])
|
||||
_, err := b.ReadFrom(io.LimitReader(r, lim))
|
||||
return b.Bytes(), err
|
||||
}
|
||||
|
||||
func init() {
|
||||
image.RegisterFormat("tiff", leHeader, Decode, DecodeConfig)
|
||||
image.RegisterFormat("tiff", beHeader, Decode, DecodeConfig)
|
||||
|
2
vendor/golang.org/x/text/language/match.go
generated
vendored
2
vendor/golang.org/x/text/language/match.go
generated
vendored
@ -434,7 +434,7 @@ func newMatcher(supported []Tag, options []MatchOption) *matcher {
|
||||
// (their canonicalization simply substitutes a different language code, but
|
||||
// nothing else), the match confidence is Exact, otherwise it is High.
|
||||
for i, lm := range language.AliasMap {
|
||||
// If deprecated codes match and there is no fiddling with the script or
|
||||
// If deprecated codes match and there is no fiddling with the script
|
||||
// or region, we consider it an exact match.
|
||||
conf := Exact
|
||||
if language.AliasTypes[i] != language.Macro {
|
||||
|
Reference in New Issue
Block a user