[poppler] poppler/Form.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 14 11:36:48 UTC 2021


 poppler/Form.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4aca8d65fd073667433e4426c5c08d7e9ea68d64
Author: Nelson Benítez León <nbenitezl at gmail.com>
Date:   Tue Dec 14 01:14:19 2021 +0000

    poppler/Form.cc: fix crash when calling Form::reset()
    
    caused by calling compare() with a negative 'pos'
    argument.
    
    Fixes issue https://gitlab.gnome.org/GNOME/evince/-/issues/1694

diff --git a/poppler/Form.cc b/poppler/Form.cc
index cb6f62f8..209b6cfb 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -2554,7 +2554,7 @@ void Form::reset(const std::vector<std::string> &fields, bool excludeFields)
             for (const std::string &field : fields) {
                 Ref fieldRef;
 
-                if (field.compare(field.size() - 2, 2, " R") == 0 && sscanf(field.c_str(), "%d %d R", &fieldRef.num, &fieldRef.gen) == 2) {
+                if (field.size() > 1 && field.compare(field.size() - 2, 2, " R") == 0 && sscanf(field.c_str(), "%d %d R", &fieldRef.num, &fieldRef.gen) == 2) {
                     foundField = findFieldByRef(fieldRef);
                 } else {
                     foundField = findFieldByFullyQualifiedName(field);


More information about the poppler mailing list