-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/mathml.dict
# build our own fuzz dict for odf, following the pattern of svg.dict
echo "# Keywords taken from libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng" > odf.dict
+echo "# and libreoffice/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng" >> odf.dict
echo "# tags" >> odf.dict
-grep "rng:element name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:element name="#"<#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
+grep -h "rng:element name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng libreoffice/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng | sed 's#<rng:element name="#"<#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
echo "# attributes " >> odf.dict
-grep "rng:attribute name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:attribute name="#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
+grep -h "rng:attribute name=" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng libreoffice/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng | sed 's#<rng:attribute name="#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' >> odf.dict
echo "# attributes' values" >> odf.dict
-grep "rng:value" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng | sed 's#<rng:value>#"#;s#</rng:value>#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' | sort | uniq >> odf.dict
+grep -h "rng:value" libreoffice/schema/odf1.3/OpenDocument-v1.3-schema.rng libreoffice/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng | sed 's#<rng:value>#"#;s#</rng:value>#"#;s#^[[:blank:]]*##;s#[[:blank:]>]*$##' | sort | uniq >> odf.dict
#fuzzing corpuses
#afl jpeg, gif, bmp, png, webp
nPositionContent = o3tl::toInt32( rBlankWidthString.substr( i ) );
}
nPositionContent += nShiftPosition;
- if ( nPositionContent >= 0 )
+ if ( nPositionContent >= 0 && nPositionContent <= rContent.getLength() )
{
rContent.remove( nPositionContent, aBlanks.getLength() );
if ( nPositionContent >= 1 && rContent[ nPositionContent-1 ] == '\"' )
}
}
// remove empty string at the end of rContent
- if ( std::u16string_view( rContent ).substr( rContent.getLength() - 2 ) == u"\"\"" )
+ sal_Int32 nLen = rContent.getLength();
+ if ( nLen >= 3 && std::u16string_view( rContent ).substr( nLen - 2 ) == u"\"\"" && rContent[ nLen-3 ] != '\\' )
{
- sal_Int32 nLen = rContent.getLength();
- if ( nLen >= 3 && rContent[ nLen-3 ] != '\\' )
- rContent.truncate( nLen - 2 );
+ rContent.truncate( nLen - 2 );
}
}
}