Minor revision
This commit is contained in:
parent
c0927c05dd
commit
bcb24af926
|
@ -64,7 +64,7 @@ std::string ssprintf(const std::string& format, Args... args) {
|
||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/// PDF token/object thingy. Objects may be composed either from one or a sequence of tokens.
|
/// PDF token/object thingy. Objects may be composed either from one or a sequence of tokens.
|
||||||
/// The PDF Reference doesn't actually speak of tokens.
|
/// The PDF Reference doesn't actually speak of tokens, though ISO 32000-1:2008 does.
|
||||||
struct pdf_object {
|
struct pdf_object {
|
||||||
enum type {
|
enum type {
|
||||||
END, NL, COMMENT, NIL, BOOL, NUMERIC, KEYWORD, NAME, STRING,
|
END, NL, COMMENT, NIL, BOOL, NUMERIC, KEYWORD, NAME, STRING,
|
||||||
|
@ -543,8 +543,8 @@ std::string pdf_updater::initialize() {
|
||||||
const auto prev_offset = trailer.dict.find("Prev");
|
const auto prev_offset = trailer.dict.find("Prev");
|
||||||
if (prev_offset == trailer.dict.end())
|
if (prev_offset == trailer.dict.end())
|
||||||
break;
|
break;
|
||||||
// FIXME we don't check for size_t over or underflow
|
// FIXME do not read offsets and sizes as floating point numbers
|
||||||
if (!prev_offset->second.is_integer())
|
if (!prev_offset->second.is_integer() || prev_offset->second.number < 0)
|
||||||
return "invalid Prev offset";
|
return "invalid Prev offset";
|
||||||
xref_offset = prev_offset->second.number;
|
xref_offset = prev_offset->second.number;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ const (
|
||||||
|
|
||||||
// Object is a PDF token/object thingy. Objects may be composed either from
|
// Object is a PDF token/object thingy. Objects may be composed either from
|
||||||
// one or a sequence of tokens. The PDF Reference doesn't actually speak
|
// one or a sequence of tokens. The PDF Reference doesn't actually speak
|
||||||
// of tokens.
|
// of tokens, though ISO 32000-1:2008 does.
|
||||||
type Object struct {
|
type Object struct {
|
||||||
Kind ObjectKind
|
Kind ObjectKind
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ func NewUpdater(document []byte) (*Updater, error) {
|
||||||
if !ok {
|
if !ok {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// FIXME: We don't check for size_t over or underflow.
|
// FIXME: Do not read offsets and sizes as floating point numbers.
|
||||||
if !prevOffset.IsInteger() {
|
if !prevOffset.IsInteger() {
|
||||||
return nil, errors.New("invalid Prev offset")
|
return nil, errors.New("invalid Prev offset")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue