Index: src/wp-includes/class-wp-query.php
===================================================================
--- src/wp-includes/class-wp-query.php	(revision 43581)
+++ src/wp-includes/class-wp-query.php	(working copy)
@@ -1806,6 +1806,14 @@
 		if ( ( isset( $q['posts_per_archive_page'] ) && $q['posts_per_archive_page'] != 0 ) && ( $this->is_archive || $this->is_search ) ) {
 			$q['posts_per_page'] = $q['posts_per_archive_page'];
 		}
+		if ( $this->is_feed ) {
+			// This overrides posts_per_page.
+			if ( ! empty( $q['posts_per_rss'] ) ) {
+				$q['posts_per_page'] = $q['posts_per_rss'];
+			} else {
+				$q['posts_per_page'] = get_option( 'posts_per_rss' );
+			}
+		}
 		if ( ! isset( $q['nopaging'] ) ) {
 			if ( $q['posts_per_page'] == -1 ) {
 				$q['nopaging'] = true;
@@ -1814,15 +1822,6 @@
 			}
 		}
 
-		if ( $this->is_feed ) {
-			// This overrides posts_per_page.
-			if ( ! empty( $q['posts_per_rss'] ) ) {
-				$q['posts_per_page'] = $q['posts_per_rss'];
-			} else {
-				$q['posts_per_page'] = get_option( 'posts_per_rss' );
-			}
-			$q['nopaging'] = false;
-		}
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
 		if ( $q['posts_per_page'] < -1 ) {
 			$q['posts_per_page'] = abs( $q['posts_per_page'] );
Index: tests/phpunit/tests/query.php
===================================================================
--- tests/phpunit/tests/query.php	(revision 43581)
+++ tests/phpunit/tests/query.php	(working copy)
@@ -57,6 +57,26 @@
 	}
 
 	/**
+	 * @ticket 42261
+	 */
+	function test_rss_query_no_limit() {
+		self::factory()->post->create_many( 15 );
+
+		// Programmatically set posts_per_rss to -1
+		add_filter( 'option_posts_per_rss', array( $this, 'filter_option_posts_per_rss' ) );
+
+		$this->go_to( get_feed_link() );
+
+		global $wp_query;
+
+		$this->assertEquals( 15, count( $wp_query->posts ) );
+	}
+
+	public function filter_option_posts_per_rss() {
+		return -1;
+	}
+
+	/**
 	 * @ticket 26627
 	 */
 	function test_tag_queried_object() {
