Skip to content
Snippets Groups Projects
  • Markus Armbruster's avatar
    5891c388
    qobject-input-visitor: Reject non-finite numbers with keyval · 5891c388
    Markus Armbruster authored
    
    The QObject input visitor can produce only finite numbers when its
    input comes out of the JSON parser, because the the JSON parser
    implements RFC 7159, which provides no syntax for infinity and NaN.
    
    However, it can produce infinity and NaN when its input comes out of
    keyval_parse(), because we parse with strtod() then.
    
    The keyval variant should not be able to express things the JSON
    variant can't.  Rejecting non-finite numbers there is the conservative
    fix.  It's also minimally invasive.
    
    We could instead extend our JSON dialect to provide for infinity and
    NaN.  Not today.
    
    Note that the JSON formatter can emit non-finite numbers (marked FIXME
    in commit 6e8e5cb9).
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1495471335-23707-2-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
    5891c388
    History
    qobject-input-visitor: Reject non-finite numbers with keyval
    Markus Armbruster authored
    
    The QObject input visitor can produce only finite numbers when its
    input comes out of the JSON parser, because the the JSON parser
    implements RFC 7159, which provides no syntax for infinity and NaN.
    
    However, it can produce infinity and NaN when its input comes out of
    keyval_parse(), because we parse with strtod() then.
    
    The keyval variant should not be able to express things the JSON
    variant can't.  Rejecting non-finite numbers there is the conservative
    fix.  It's also minimally invasive.
    
    We could instead extend our JSON dialect to provide for infinity and
    NaN.  Not today.
    
    Note that the JSON formatter can emit non-finite numbers (marked FIXME
    in commit 6e8e5cb9).
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1495471335-23707-2-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>