Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: Source/core/html/parser/XSSAuditor.cpp

Issue 1310153004: Off by one in XSSAuditor::canonicalizedSnippetForJavaScript() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/script-tag-with-trailing-script-and-urlencode-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Adam Barth. All Rights Reserved. 2 * Copyright (C) 2011 Adam Barth. All Rights Reserved.
3 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com). 3 * Copyright (C) 2011 Daniel Bates (dbates@intudata.com).
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 if (startsSingleLineCommentAt(string, foundPosition) 760 if (startsSingleLineCommentAt(string, foundPosition)
761 || startsMultiLineCommentAt(string, foundPosition) 761 || startsMultiLineCommentAt(string, foundPosition)
762 || startsHTMLCommentAt(string, foundPosition)) { 762 || startsHTMLCommentAt(string, foundPosition)) {
763 break; 763 break;
764 } 764 }
765 } 765 }
766 if (string[foundPosition] == ',' || string[foundPosition] == '`') 766 if (string[foundPosition] == ',' || string[foundPosition] == '`')
767 break; 767 break;
768 768
769 if (lastNonSpacePosition != kNotFound && startsOpeningScriptTagAt(st ring, foundPosition)) { 769 if (lastNonSpacePosition != kNotFound && startsOpeningScriptTagAt(st ring, foundPosition)) {
770 foundPosition = lastNonSpacePosition; 770 foundPosition = lastNonSpacePosition + 1;
771 break; 771 break;
772 } 772 }
773 if (foundPosition > startPosition + kMaximumFragmentLengthTarget) { 773 if (foundPosition > startPosition + kMaximumFragmentLengthTarget) {
774 // After hitting the length target, we can only stop at a point where we know we are 774 // After hitting the length target, we can only stop at a point where we know we are
775 // not in the middle of a %-escape sequence. For the sake of sim plicity, approximate 775 // not in the middle of a %-escape sequence. For the sake of sim plicity, approximate
776 // not stopping inside a (possibly multiply encoded) %-escape se quence by breaking on 776 // not stopping inside a (possibly multiply encoded) %-escape se quence by breaking on
777 // whitespace only. We should have enough text in these cases to avoid false positives. 777 // whitespace only. We should have enough text in these cases to avoid false positives.
778 if (isHTMLSpace<UChar>(string[foundPosition])) 778 if (isHTMLSpace<UChar>(string[foundPosition]))
779 break; 779 break;
780 } 780 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 822
823 bool XSSAuditor::isSafeToSendToAnotherThread() const 823 bool XSSAuditor::isSafeToSendToAnotherThread() const
824 { 824 {
825 return m_documentURL.isSafeToSendToAnotherThread() 825 return m_documentURL.isSafeToSendToAnotherThread()
826 && m_decodedURL.isSafeToSendToAnotherThread() 826 && m_decodedURL.isSafeToSendToAnotherThread()
827 && m_decodedHTTPBody.isSafeToSendToAnotherThread() 827 && m_decodedHTTPBody.isSafeToSendToAnotherThread()
828 && m_httpBodyAsString.isSafeToSendToAnotherThread(); 828 && m_httpBodyAsString.isSafeToSendToAnotherThread();
829 } 829 }
830 830
831 } // namespace blink 831 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/xssAuditor/script-tag-with-trailing-script-and-urlencode-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698